Support joins from sqlite tables in tile-join (#308)

* Sketching out sqlite options for tile-join

* Enable sqlite3 serialized multithreading

* Fix some unnecessary round trips from std::string to char * and back

* Gathering join keys for sql query

* Make a query

* Actually open the gpkg. Fix the query quoting.

* Actually do the query and get results back

* Join the attributes onto the feature

* Set matched if the sql join matches

* Add a flag to get the feature ID from the query

* Observe attribute exclusion when joining from sql queries

* Add a flag to exclude all attributes from the tile side of the join

* Make tile-join bounding boxes reflect feature bounds, not tile bounds

* More tests

* An empty tileset has empty bounds at null island

* Gather the results from each thread *after* the thread finishes

* Missed a test

* Fix accidental inclusion of the top left of the tile in the bbox

* Case smashing and prefix trimming in the select

* Add test of sql join

* Make the join column option a join expression option

* Fix antimeridian adjustment. Z0 can't wait until the end of the tile

* Checkpoint on accepting multiple joined rows per tiled feature

* Adding the joined attribute should be per-feature, not per-attribute

* Forgot to update the test. Order of joined attributes has changed.

* Get the attributes back in the right order

* Add test of sql join with limit

* Allow multiple tile features to have the same join key

* Update tests for a country name with two distinct geometries

* Update version and changelog

* Forgot to mention the bounding box improvements
This commit is contained in:
Erica Fischer
2025-01-13 12:25:00 -08:00
committed by GitHub
parent 7165ae6999
commit 10f7f0a3c2
29 changed files with 564 additions and 224 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-180.000000,-85.051129,180.000000,85.051129",
"bounds": "-180.000000,-85.051129,180.000000,85.051129",
"antimeridian_adjusted_bounds": "-122.255859,37.718590,-122.080078,37.857507",
"bounds": "-122.255859,37.718590,-122.080078,37.857507",
"center": "-122.104097,37.695438,0",
"description": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.309418,37.881357,-122.280579,37.900865",
"bounds": "-122.309418,37.881357,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.857507,-122.255859,37.926868",
"bounds": "-122.343750,37.857507,-122.255859,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,7 +1,7 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"antimeridian_adjusted_bounds": "-122.294655,37.694688,-122.103424,37.833649",
"attribution": "macarthur's attribution",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"bounds": "-122.294655,37.694688,-122.103424,37.833649",
"center": "-122.299805,37.892187,11",
"description": "macarthur description",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.439974,-121.992188,37.996163",
"bounds": "-122.343750,37.439974,-121.992188,37.996163",
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"center": "-122.167969,37.833010,9",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.439974,-121.992188,37.996163",
"bounds": "-122.343750,37.439974,-121.992188,37.996163",
"antimeridian_adjusted_bounds": "-122.294655,37.695231,-122.103424,37.833107",
"bounds": "-122.294655,37.695231,-122.103424,37.833107",
"center": "-122.167969,37.833010,9",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.694688,-122.103424,37.900865",
"bounds": "-122.343750,37.694688,-122.103424,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420-folder",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.694688,-122.103424,37.900865",
"bounds": "-122.343750,37.694688,-122.103424,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.874853,-122.280579,37.900865",
"bounds": "-122.343750,37.874853,-122.280579,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"antimeridian_adjusted_bounds": "-122.343750,37.694688,-122.103424,37.900865",
"bounds": "-122.343750,37.694688,-122.103424,37.900865",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.439974,-121.992188,37.996163",
"bounds": "-122.343750,37.439974,-121.992188,37.996163",
"antimeridian_adjusted_bounds": "-122.294655,37.694688,-122.103424,37.833649",
"bounds": "-122.294655,37.694688,-122.103424,37.833649",
"center": "-122.167969,37.828608,10",
"description": "tests/join-population/macarthur2.mbtiles",
"format": "pbf",
+2 -2
View File
@@ -1,6 +1,6 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-122.343750,37.439974,-121.992188,37.996163",
"bounds": "-122.343750,37.439974,-121.992188,37.996163",
"antimeridian_adjusted_bounds": "-122.294655,37.694688,-122.103424,37.833649",
"bounds": "-122.294655,37.694688,-122.103424,37.833649",
"center": "-122.167969,37.833010,10",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",