Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeating/duplicate state label points #4

Open
PetersonGIS opened this issue Jan 29, 2018 · 8 comments
Open

Repeating/duplicate state label points #4

PetersonGIS opened this issue Jan 29, 2018 · 8 comments

Comments

@PetersonGIS
Copy link
Owner

No description provided.

@PetersonGIS PetersonGIS changed the title Repeating state label points Repeating/duplicate state label points Jan 29, 2018
@PetersonGIS
Copy link
Owner Author

Currently: state_label_points from ne_10m_admin_1_label_points; zoom 4-10, filter scalerank == 2

Fix: use ne_10m_admin_1_label_points_details instead. It contains just one point per state.

@PetersonGIS
Copy link
Owner Author

The url for the dataset mentioned above 404s.
http://naciscdn.org/naturalearth/10m/cultural/ne_10m_admin_1_label_points_details.zip
Even though it is available in the natural earth geopackage.

@PetersonGIS
Copy link
Owner Author

Selecting for adm0_sr = 1 from ne_10m_admin_1_points is the solution. Requires adding adm0_sr to tegola.toml sql as this field isn't currently used.

@PetersonGIS
Copy link
Owner Author

PetersonGIS commented May 5, 2018

This shows the difference between the two state label point layers. The only immediately visible problems are the Vermont and Indiana placements. But this seems better than the current state of labeling in the tegola-osm repo.
statelabels

@PetersonGIS
Copy link
Owner Author

See more on the above issue at
nvkelso/natural-earth-vector#145

@PetersonGIS
Copy link
Owner Author

clhenrick's solution in above mentioned thread works beautifully in tegola:

labels2

Using the following in the config.toml

[[providers.layers]]
name = "ne_110m_admin_1_states_provinces"
geometry_fieldname = "geometry"
id_fieldname = "ogc_fid"
sql = "SELECT DISTINCT ON (name) name, admin, scalerank, ST_AsBinary(ST_PointOnSurface(wkb_geometry)) AS geometry, ogc_fid, name, admin, scalerank, min_label, max_label FROM ne_110m_admin_1_states_provinces WHERE wkb_geometry && !BBOX!"

@PetersonGIS
Copy link
Owner Author

And, using the 10m table to add in all the states worldwide and the tegola zoom token, the optimal sql seems to be:

sql = "SELECT DISTINCT ON (name) name, admin, scalerank, ST_AsBinary(ST_PointOnSurface(wkb_geometry)) AS geometry, ogc_fid, name, admin, scalerank, min_label, max_label FROM ne_10m_admin_1_states_provinces WHERE (min_label - 1) <= !ZOOM! AND wkb_geometry && !BBOX!"

@PetersonGIS
Copy link
Owner Author

In summary, we're deleting the old state labels, which had a lot of duplicates showing up at the same time and were based on the table containing admin 1 labels and instead using a custom sql query on a new table that we'll add to the database containing admin 1 polys converted via sql to distinct points. We're keeping the same final name for the output layer ("state_label_points") so that the styles that use that layer won't break, though they may need to be tweaked once the change goes through since they are based on scalerank=2, which will probably no longer be a needed constraint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant