Skip to content

Commit

Permalink
Add test of sql join
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Jan 3, 2025
1 parent dda13b3 commit d2279bc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,13 @@ join-test: tippecanoe tippecanoe-decode tile-join
./tippecanoe-decode -x generator tests/ne_110m_ocean/join/joined.mbtiles > tests/ne_110m_ocean/join/joined.mbtiles.json.check
cmp tests/ne_110m_ocean/join/joined.mbtiles.json.check tests/ne_110m_ocean/join/joined.mbtiles.json
rm -f tests/ne_110m_ocean/join/ocean.mbtiles tests/ne_110m_ocean/join/countries.mbtiles tests/ne_110m_ocean/join/joined.mbtiles tests/ne_110m_ocean/join/joined.mbtiles.json.check
#
# Test sql join
#
./tile-join -i -f -o tests/join-sql/countries.pmtiles --join-sqlite tests/join-sql/countries.gpkg --join-table countries --join-tile-column ne10-admin0:name_en --join-table-column country tests/join-sql/bboxes.pmtiles
./tippecanoe-decode -x generator tests/join-sql/countries.pmtiles > tests/join-sql/countries.pmtiles.json.check
cmp tests/join-sql/countries.pmtiles.json.check tests/join-sql/countries.pmtiles.json
rm -f tests/join-sql/countries.pmtiles tests/join-sql/countries.pmtiles.json.check

accumulate-test:
# there are 144 features with POP1950 in the original dataset
Expand Down
Binary file added tests/join-sql/bboxes.pmtiles
Binary file not shown.
Binary file added tests/join-sql/countries.gpkg
Binary file not shown.
25 changes: 25 additions & 0 deletions tests/join-sql/countries.pmtiles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-61.797841,-21.370782,55.854503,55.065334",
"bounds": "-61.797841,-21.370782,55.854503,55.065334",
"center": "0.000000,0.000000,0",
"description": "/tmp/tmp588djzw6/bboxes.pmtiles",
"format": "pbf",
"generator_options": "tippecanoe '--tile-stats-values-limit=1' -o /tmp/tmp588djzw6/bboxes.pmtiles -l parsed-bboxes -U1 '--smallest-maximum-zoom-guess=7' -Bg --drop-fraction-as-needed -P --hilbert --generate-variable-depth-tile-pyramid -rp -b0 '--extend-zooms-if-still-dropping-maximum=3' '--extra-detail=30' -D10 '--tiny-polygon-size=1' --no-tiny-polygon-reduction-at-maximum-zoom '--simplification=1' '--simplification-at-maximum-zoom=0.25' --detect-longitude-wraparound --preserve-input-order '--maximum-tile-bytes=2621440' '--maximum-string-attribute-length=65536' --preserve-point-density-threshold 64 --set-attribute '{\"felt:cluster_size\": 1}' --accumulate-attribute '{\"felt:cluster_size\": \"sum\"}' --preserve-multiplier-density-threshold 512 '--accumulate-numeric-attributes=felt' /tmp/tmpg9jf8evz/parsed.geojsonseq.gz; ./tile-join -i -f -o tests/join-sql/countries.pmtiles --join-sqlite tests/join-sql/countries.gpkg --join-table countries --join-tile-column ne10-admin0:name_en --join-table-column country tests/join-sql/bboxes.pmtiles",
"json": "{\"vector_layers\":[{\"id\":\"parsed-bboxes\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"another\":\"String\",\"country\":\"String\",\"felt:cluster_size\":\"Number\",\"fid\":\"Number\",\"ne10-admin0:iso_a2_eh\":\"String\",\"ne10-admin0:iso_a3_eh\":\"String\",\"ne10-admin0:name_en\":\"String\",\"something\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"parsed-bboxes\",\"count\":3,\"geometry\":\"Polygon\",\"attributeCount\":8,\"attributes\":[{\"attribute\":\"another\",\"count\":3,\"type\":\"string\",\"values\":[\"bar\",\"why\",\"yes\"]},{\"attribute\":\"country\",\"count\":3,\"type\":\"string\",\"values\":[\"France\",\"Germany\",\"Italy\"]},{\"attribute\":\"felt:cluster_size\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"fid\",\"count\":3,\"type\":\"number\",\"values\":[1,2,3],\"min\":1,\"max\":3},{\"attribute\":\"ne10-admin0:iso_a2_eh\",\"count\":3,\"type\":\"string\",\"values\":[\"de\",\"fr\",\"it\"]},{\"attribute\":\"ne10-admin0:iso_a3_eh\",\"count\":3,\"type\":\"string\",\"values\":[\"deu\",\"fra\",\"ita\"]},{\"attribute\":\"ne10-admin0:name_en\",\"count\":3,\"type\":\"string\",\"values\":[\"france\",\"germany\",\"italy\"]},{\"attribute\":\"something\",\"count\":3,\"type\":\"string\",\"values\":[\"blah\",\"foo\",\"what\"]}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "/tmp/tmp588djzw6/bboxes.pmtiles",
"strategies": "[{\"truncated_zooms\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "parsed-bboxes", "version": 2, "extent": 1073741824 }, "features": [
{ "type": "Feature", "id": 322, "properties": { "ne10-admin0:name_en": "germany", "another": "yes", "country": "Germany", "fid": 1, "something": "blah", "ne10-admin0:iso_a2_eh": "de", "ne10-admin0:iso_a3_eh": "deu", "felt:cluster_size": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 15.022060, 47.271121 ], [ 5.852490, 47.271121 ], [ 5.852490, 55.065334 ], [ 15.022060, 55.065334 ], [ 15.022060, 47.271121 ] ] ] } }
,
{ "type": "Feature", "id": 435, "properties": { "ne10-admin0:name_en": "france", "another": "why", "country": "France", "fid": 2, "something": "what", "ne10-admin0:iso_a2_eh": "fr", "ne10-admin0:iso_a3_eh": "fra", "felt:cluster_size": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -61.797841, -21.370782 ], [ -61.797841, 51.087541 ], [ 55.854503, 51.087541 ], [ 55.854503, -21.370782 ], [ -61.797841, -21.370782 ] ] ] } }
,
{ "type": "Feature", "id": 650, "properties": { "ne10-admin0:name_en": "italy", "another": "bar", "country": "Italy", "fid": 3, "something": "foo", "ne10-admin0:iso_a2_eh": "it", "ne10-admin0:iso_a3_eh": "ita", "felt:cluster_size": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 18.517426, 35.489244 ], [ 6.602728, 35.489244 ], [ 6.602728, 47.085215 ], [ 18.517426, 47.085215 ], [ 18.517426, 35.489244 ] ] ] } }
] }
] }
] }

0 comments on commit d2279bc

Please sign in to comment.