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

Duplicate labels #75

Open
makella opened this issue Aug 9, 2016 · 15 comments
Open

Duplicate labels #75

makella opened this issue Aug 9, 2016 · 15 comments

Comments

@makella
Copy link
Contributor

makella commented Aug 9, 2016

Noticing a lot of duplicate labels on our basemaps. In this example, you'll see that neighborhoods are labeled twice once above and once below tile boundaries. One fix for this might be to use text-avoid-edges: true but we would have to test the impacts across the world and with other labels.

Example at z15 in the Washington, DC area:

screen shot 2016-08-09 at 11 23 32 am

@makella
Copy link
Contributor Author

makella commented Aug 9, 2016

More examples of duplicates (blue) and also cut off labels (orange)

uh oh!

screen shot 2016-08-09 at 12 02 57 pm

@makella
Copy link
Contributor Author

makella commented Aug 10, 2016

I was also thinking for the cut off labels (orange above) we might try increasing the Map {buffer-size:..}

cc @saleiva

@pnorman
Copy link
Contributor

pnorman commented Aug 10, 2016

Map {
  background-color: @water;
  buffer-size: 256;
}

256 should be sufficient buffer for all these labels. It's more likely a case of undefined ordering of results in the SQL or some of Mapnik's myriad buffer/edge/clip settings being wrong.

@makella
Copy link
Contributor Author

makella commented Aug 10, 2016

yeah i thought we could try text-avoid-edges but without testing more, i'm worried to do that. I thought an easy fix for the cut off (not duplicate) would be to go to 512. But again, it probably all needs testing.

I didn't notice this many duplicates in the past.

Has something changed?

@pnorman
Copy link
Contributor

pnorman commented Aug 10, 2016

yeah i thought we could try text-avoid-edges but without testing more, i'm worried to do that.

This is a problem for places on a tile boundary, they won't get a label at all.

Looking at the problems here, I think there's two independent problems. One is duplicate labels, the other is cut off labels. I suggest solving duplicate first.

I haven't tested, but based on the output it looks like it comes from rendering both place points and place polygons and there being duplicates in the data.

Fixing gravitystorm/openstreetmap-carto#103 would cause this to get cleaned up quickly.

@makella
Copy link
Contributor Author

makella commented Aug 10, 2016

I thought the same but I don't see place polygons... in the basemap files. Unless I've totally missed them? I didn't even know that place polygons were part of OSM?

@makella
Copy link
Contributor Author

makella commented Aug 10, 2016

That labeling behavior is classic of polygons...

@makella
Copy link
Contributor Author

makella commented Aug 10, 2016

And I've used text-avoid-edges: true in conjunction with other labeling properties in the past and it doesn't completely eliminate the label from my experience but does to some degree help tame the duplicates

@mojodna
Copy link
Contributor

mojodna commented Aug 10, 2016

If Mapnik 3.x is in use behind the scenes, text-repeat-distance is perfect for this kind of thing (since it only applies to labels with the same text).

@pnorman
Copy link
Contributor

pnorman commented Aug 10, 2016

I thought the same but I don't see place polygons... in the basemap files. Unless I've totally missed them? I didn't even know that place polygons were part of OSM?

http://www.openstreetmap.org/relation/4636912
http://www.openstreetmap.org/node/158315461

The centroid and node location are where the two labels in the screenshot are.

If Mapnik 3.x is in use behind the scenes, text-repeat-distance is perfect for this kind of thing (since it only applies to labels with the same text).

Does this cause more problems at MT edges where in one buffered MT has both objects but the other only has one? I imagine you'd want text-repeat-distance fairly high.

@mojodna
Copy link
Contributor

mojodna commented Aug 10, 2016

Does this cause more problems at MT edges where in one buffered MT has both objects but the other only has one? I imagine you'd want text-repeat-distance fairly high.

We've been setting the distance as large as is feasible (metatile size + buffer) and that seems to help.

@makella
Copy link
Contributor Author

makella commented Aug 11, 2016

we can't use text-repeat-distance.... what is another alternative?

@makella
Copy link
Contributor Author

makella commented Aug 11, 2016

text-min-distance maybe? i'll try

@zenitraM
Copy link
Contributor

zenitraM commented Aug 11, 2016

Trying to fight some recent traffic peaks we tweaked some tiler/Mapnik parameters some days ago, one of them was simplify_clip_resolution which enabled clipping geometries to the boundaries of the tile + buffer on PostGIS before getting to Mapnik. It seems it probably is causing havoc on the labels as Mapnik gets the clipped geometry instead of the entire one.

Disabling it now

@pnorman
Copy link
Contributor

pnorman commented Aug 11, 2016

Trying to fight some recent traffic peaks we tweaked some tiler/Mapnik parameters some days ago, one of them was simplify_clip_resolution which enabled clipping geometries to the boundaries of the tile + buffer on PostGIS before getting to Mapnik. It seems it probably is causing havoc on the labels as Mapnik gets the clipped geometry instead of the entire one.

This would do it. If you have a polygon you are labeling you'd get two polygons when splitting at the MT boundaries, each of which has its own centroid.

The issues are similar to vector tiles and polygon labeling, you can only clip geometries if you're not labeling based on them. For vector tiles the solution is to use ST_PointOnSurface

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

4 participants