tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
509 stars 119 forks source link

Add top-level-countries DBF from Natural Earth #2075

Closed nvkelso closed 2 years ago

nvkelso commented 2 years ago

The following archive:

https://naciscdn.org/naturalearth/5.1.0/housekeeping/ne_admin_0_details.zip

Includes a new table:

ne_admin_0_details_top_level_countries.dbf

That table needs to be added to Postgres as source of truth for "country-ness". Currently it's a join against the admin-0 countries table, which doesn't include all the data we want. This new file does.

tgrigsby-sc commented 2 years ago

@nvkelso I'm looking at this - may need to meet with you to figure out how to wire this in

nvkelso commented 2 years ago

You could load it using a tool like: https://pgloader.readthedocs.io/en/latest/ref/dbf.html

Though see my comment below about loading 2 separate shapefiles instead which pattern matches better with what we already do.

Add it/them to the list of assets around here:

You'll want to configure the extra TLC point-of-view around here:

But that assumes fclass_tlc is present on all related SHPs, which might not be true yet? I'll see if I need to unblock you there.

Then for the lookup for the "country" min_zoom, that's in:

Which spans across multiple tables today (across input Natural Earth themes across feature classes and kinds), which is problematic because the same Wikidata can be present in multiple tables, sometimes for the same conceptual feature and sometimes not (eg fuzzy versus strict matching) – take France for example.

So the reason we want to load this new table is we want to get only the curated set of strict matches.

There is an alternate way of doing this, which is to load 2 new shapefiles instead of 1 DBF, and then splitting the current function so admin-0 is treated separately from admin-1, localities & etc. For the new admin-0 it'd could be a coalesce across the ISO and TLC shapefiles instead (I'd first look in ISO, then in TLC). That should include 100% of what's in the source DBF (which is used as input for both these SHP).

Bonus points for picking up the curated label_x and label_y properties out of those tables, as well as fclass_iso and fclass_tlc.

tgrigsby-sc commented 2 years ago

Looks like our whole shapefile bundle build expects shp files. Adding a dbf will break a few assumptions in the process so I'm going to go with the two shp's approach

tgrigsby-sc commented 2 years ago

Reducing scope here a little for simplicilty. Going to:

nvkelso commented 2 years ago

Fixed via https://github.com/tilezen/vector-datasource/pull/2078.