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

Major rewrite landcover labelling #941

Merged
merged 10 commits into from
Oct 6, 2014

Conversation

matthijsmelissen
Copy link
Collaborator

@matthijsmelissen matthijsmelissen commented Sep 12, 2014

This commit changes the rendering of landcover labels.

For the purpose of this commit, with 'landcover label' we mean text connected to
a background colour or pattern rendering, and not connected to an icon.

@matthijsmelissen
Copy link
Collaborator Author

Please don't merge this yet, I would like to receive some feedback first.

Here follow some rendering examples.

All landuse types before and after:
screenshot from 2014-09-12 23 55 43
screenshot from 2014-09-12 23 53 13

Z14 before and after (note that the names of the larger landuses Cimetiere de Merl, Campus Geeseknappchen, and Parc Niedergrunewald now appear, and note that the forest names Lei and Enneschte Besch are now rendered larger):
screenshot from 2014-09-12 23 58 08
screenshot from 2014-09-12 23 57 48

Z15 before and after (note that the name of Cimetiere de Merl is now rendered larger, but the names of the small sport clubs, schools, and allotments remain hidden):
screenshot from 2014-09-12 23 58 52
screenshot from 2014-09-12 23 59 13

Z16 before and after (the cemetery name is now rendered even bigger, and the names of the sports clubs show up):
screenshot from 2014-09-12 23 59 56
screenshot from 2014-09-12 23 59 27

@matthijsmelissen
Copy link
Collaborator Author

Some notes:

  • It's hard to predict how this will behave in different areas, so I would like to invite everyone to test this on his/her region.
  • I would prefer to also require a maximum pixel size, since a label in the middle of a nearly screen-filling area is not useful. However, this is not that easy to implement without running into Bug in parsing of nested integer selectors mapbox/carto#369 or Numerical selector unexpectedly ignored mapbox/carto#370.
  • Take into account that landcover labels are rendered with lower priority than street names, so landcover labels can never prevent the rendering of street names.
  • I'm not sure whether we should render universities oblique, or keep them bold. In fact, I'm not a designer, so I'm not sure if using oblique fonts for other landuse types is a good idea either.
  • Note that the code order in amenity-points.mss is a bit of a mess. I deliberately did not change the order now, to make the diff's easier to read.

@matkoniecz
Copy link
Contributor

"so I would like to invite everyone to test this on his/her region" - asking on mailing list for feedback would be a good idea, but it would require comparison website (like one for #599 made by @pnorman)

@HolgerJeromin
Copy link
Contributor

University oblique is ok for me as they can be quite large as in Aachen.

@mboeringa
Copy link

I think this is a nice enhancement, and will generally work out quite well.

Just a couple of remarks:

  • I think you swapped the images of Z14 and Z16 here in terms of before and after?
  • The labelling size based on pixel area size is a nice one. I have been looking at similar issues in my renderer, but this is really difficult thing to implement properly in ArcGIS. I would though, getting back to your modifications, maybe keep the difference between the labels a bit smaller, and also the largest font used. The "Cimetiere de Merl" looks a bit to big to me at Z16. But it may need more examples and testing on other areas...
  • Maybe you could adjust the minimum area size for labeling a bit downwards from 3000. Not having the apparently quite large Stade Josy Barthel labeled at Z15 seems unjustified.
  • Maybe the outline and font of Theme Park could do with a bit more prominent colouring? Looking at the Efteling theme park in the Netherlands (http://www.openstreetmap.org/#map=16/51.6496/5.0482), it seems the brown outline despite its thick line size, is not so obvious, and may be confused with a track?
  • Maybe universities should have prominence over schools, even if the area covers the same pixel size, by a slightly larger font? In most cases, your pixel area size based font rendering should however deal with this fact quite nicely, since university campuses tend to be big (but small areas do exist of course).

@matthijsmelissen
Copy link
Collaborator Author

I think you swapped the images of Z14 and Z16 here in terms of before and after?

Thanks, fixed. Also thanks for your other comments.

@imagico
Copy link
Collaborator

imagico commented Sep 13, 2014

You could probably include the glaciers and get rid of the separate layer currently used for that

@mboeringa
Copy link

Just one other remark: is "barracks" really a landuse in OSM? Barracks are military buildings part of a military base (which is probably a landuse by itself, e.g. there is naval_base and airfield). The wiki page for the key military also describes barracks as "Buildings where soldiers live and work":

http://wiki.openstreetmap.org/wiki/Key:military

It may also be more useful to label each barrack building itself with the name and ref key...

@daganzdaanda
Copy link

Very nice! What a neat trick to show larger areas with more prominent labeling, it makes a lot of sense .
For university, I'd like to see a real life example to see how it works. Sorry, I'm not techie enough to set up the whole chain of programs needed.

I would prefer to also require a maximum pixel size, since a label in the middle of a nearly screen-filling area is not useful.

Actually, sometimes it would be useful. Zooming in on e.g. a lake, desert or large forest, I would like to see the name of that big area in my viewport, even if it's not the middle of the area that I'm looking at. But that's another issue.

@matthijsmelissen
Copy link
Collaborator Author

it would require comparison website (like one for #599 made by @pnorman)

@pnorman Do you still have the possibility to set up such a demo? That would be very helpful.

@pnorman
Copy link
Collaborator

pnorman commented Sep 15, 2014

@pnorman Do you still have the possibility to set up such a demo? That would be very helpful.

Yes, but probably can't get to it for a couple days at least.

@matkoniecz
Copy link
Contributor

It would resolve also #455

@matthijsmelissen
Copy link
Collaborator Author

Rebased. Please merge #968 first.

@matthijsmelissen
Copy link
Collaborator Author

@pnorman Any chance of getting the demo up this week?

@pnorman
Copy link
Collaborator

pnorman commented Sep 21, 2014

Tiles at http://tile.paulnorman.ca/landcover-labels/z/x/y.png
Add an a,b,c,d if you want to in front of the domain

@matthijsmelissen
Copy link
Collaborator Author

Tiles at http://tile.paulnorman.ca/landcover-labels/z/x/y.png

Thanks. I quickly set up a slippy map: http://matthijsmelissen.nl/temp/osm/landcover-labels/
I hope your server can handle that, if not I will turn it off again.

However, it seems there is something wrong with your database, most stuff is missing. Or does it only work in certain regions?

Edit: I see now that it does work in the Northeastern US. That should be a good start for testing.

@pnorman
Copy link
Collaborator

pnorman commented Sep 21, 2014

I also set up http://tile.paulnorman.ca/demo/landcover-labels.html, which has a slider.

Areas loaded are defined in a furry-sansa config as

        ('connecticut.osm.pbf',           'http://download.geofabrik.de/north-america/us/connecticut-latest.osm.pbf'),
        ('delaware.osm.pbf',              'http://download.geofabrik.de/north-america/us/delaware-latest.osm.pbf'),
        ('district-of-columbia.osm.pbf',  'http://download.geofabrik.de/north-america/us/district-of-columbia-latest.osm.pbf'),
        ('maryland-latest.osm.pbf',       'http://download.geofabrik.de/north-america/us/maryland-latest.osm.pbf'),
        ('new-jersey.osm.pbf',            'http://download.geofabrik.de/north-america/us/new-jersey-latest.osm.pbf'),
        ('new-york.osm.pbf',              'http://download.geofabrik.de/north-america/us/new-york-latest.osm.pbf'),
        ('nevada.osm.pbf',                'http://download.geofabrik.de/north-america/us/nevada-latest.osm.pbf'),
        ('georgia.osm.pbf',               'http://download.geofabrik.de/north-america/us/georgia-latest.osm.pbf'),
        ('pennsylvania.osm.pbf',          'http://download.geofabrik.de/north-america/us/pennsylvania-latest.osm.pbf'),
        ('washington.osm.pbf',            'http://download.geofabrik.de/north-america/us/washington-latest.osm.pbf'),
        ('british-columbia.osm.pbf',      'http://download.geofabrik.de/north-america/canada/british-columbia-latest.osm.pbf'),
        ('alberta.osm.pbf',               'http://download.geofabrik.de/north-america/canada/alberta-latest.osm.pbf'),
        ('ivory-coast.osm.pbf',           'http://download.geofabrik.de/africa/ivory-coast-latest.osm.pbf'),
        ('seoul.osm.pbf',                 'https://s3.amazonaws.com/metro-extracts.mapzen.com/seoul.osm.pbf'),
        ('osaka-kyoto.osm.pbf',           'https://s3.amazonaws.com/metro-extracts.mapzen.com/osaka-kyoto.osm.pbf'),
        ('krakow.osm.pbf',                'https://s3.amazonaws.com/metro-extracts.mapzen.com/krakow.osm.pbf'),

Note, city extracts failed to load as Mapzen changed the URLs.

@pnorman
Copy link
Collaborator

pnorman commented Sep 21, 2014

Bridges aren't rendering.
image
Probably an issue in a66e5d8, so I'll raise that in #968

@matthijsmelissen
Copy link
Collaborator Author

I also set up http://tile.paulnorman.ca/demo/landcover-labels.html, which has a slider.

Great, then I'll drop my slippy map.

@pnorman
Copy link
Collaborator

pnorman commented Sep 22, 2014

I'm still seeing old styling sporatically. Have a look at the Cascade Recreation Area, Skagit Valley Provincial Park, and E.C. Manning Provincial Park.
http://tile.paulnorman.ca/demo/landcover-labels.html#8.00/49.038/-120.666

z8 new
image

z9 new
image

z10 new
image
I looked into Garibaldi Provincial Park and Tantalus Provincial Park nearby, and it doesn't seem to be a data issue.

  osm_id  |           name            | natural |    leisure     |  way_area
----------+---------------------------+---------+----------------+-------------
 -2226821 | Tantalus Provincial Park  |         | nature_reserve | 2.74224e+08
 -2226817 | Garibaldi Provincial Park |         | nature_reserve | 4.55054e+09

Metatile issues seem worse. That's probably just my server.
87 | 87
That shows that labels are being placed correctly across metatiles, but I think my buffer is set up manually to something that's probably insufficient.


Tetrahedron Provincial Park label disappears from z10 to z11
image
image

The peaks are probably displacing it, and it's not a regression, so I'll open a new issue.


Mt. Baker - Snoqualmie National Forest isn't showing up. Not sure why, doesn't seem to be conflicting, on a MT boundary, or too small to label.
http://tile.paulnorman.ca/demo/landcover-labels.html#10.00/48.3727/-121.9279


The halo seems to be enough to avoid the green on green problem, but maybe it should be slightly more? On busy parks it tends to get lost slightly.
image
image


Speaking as someone who lives in an area with some massive parks and forests, I like the effect it has on low zooms.

@pnorman
Copy link
Collaborator

pnorman commented Sep 22, 2014

Great, then I'll drop my slippy map.

No need to if you don't want to - load would be the same on my server. Also, I'm not worried about server load. Initial low-zoom rendering might be slow, but the server caches everything and because it doesn't consume updates, never invalidates its cache.

This commit changes the rendering of landcover labels.

For the purpose of this commit, with 'landcover label' we mean text connected to
a background colour or pattern rendering, and not connected to an icon.

* All rendered landcover tags now have their name rendered (resolves gravitystorm#537). We
  add labels to the following tags:
  * natural=beach,scrub,grassland,heath,sand,desert (partially resolves gravitystorm#788)
  * highway=services,rest_area (resolves gravitystorm#575)
  * aeroway=apron
  * power=station,generator,substation,sub_station
  * tourism=zoo
  * military=barracks
* The minimum zoom level of labels is now defined based on the number of pixels
  rendered (resolves partially gravitystorm#703, resolves gravitystorm#861, resolves gravitystorm#913).
  Labels are rendered from 3000 pixels (but never earlier than the corresponding
  landuse is rendered).
* Font size now also depends on way_pixels. In other words, larger objects get
  a larger label, in three steps (resolves gravitystorm#308).
* Landuse labels are now rendered oblique, to easier visually tell them apart
  from village and POI labels.
* All labels are rendered in a colour similar to the landuse they belong to
  (using landuse color variables, resolves gravitystorm#56). Also some existing colours
  are changed, in order to make them clearly colourful but still readable.
* The text-halo-radius and text-wrap-width properties are made consistent across
  landuse types.
* Font-size, wrap-width an face-name are now defined by easy to change
  variables.
@daganzdaanda
Copy link

Very very cool :)
The only thing that needs tweaking IMHO is university labels, see above and also here:
http://tile.paulnorman.ca/demo/landcover-labels.html#13.00/43.0017/-78.8119
Unis are often tagged with loads of detail, buildings and green and roads. So the thin brownish font is not easy to make out.
Could adding another 1 or 1.5 px to the halo be a solution? This could make for better readability for all the landuse lables, see the "Ellicott Creek Park" and the swamp near the uni in the link above.

If the white halo looks to obtrusive when its fatter, we could use the colour of the landuse for it. It should look fine, as long as the text is different enough from the landuse.

@matthijsmelissen
Copy link
Collaborator Author

The glacier label color is somewhat greenish making it probably hard to distinguish from other greenish labels frequently around in areas of temperate region glaciers as well as water linework which is also similar in color.

@imagico I think this is (at least partially) caused by the national park overlay, which makes everything look greenish (nice example of the reason why we don't like transparency).

Does it look better on higher zoom levels, where the national park overlay is no longer rendered, for example here?

@matkoniecz
Copy link
Contributor

@math1985

Old colour of glacier label is still better on linke zoom level and lower ones.

@gravitystorm gravitystorm merged commit 74e9a68 into gravitystorm:master Oct 6, 2014
@gravitystorm
Copy link
Owner

This is too good to wait! There's a few minor things that we can follow up on separately, and I've been playing around with making the halo colours match the polyon colours - it looks good in many cases, but some times it's terrible!

Anyway, lets see this in production and go from there. Great work again by @math1985

@ian29
Copy link
Contributor

ian29 commented Oct 6, 2014

wow, excellent work!

@matkoniecz matkoniecz mentioned this pull request Oct 6, 2014
@daganzdaanda
Copy link

It's starting to show up on the map -- nice! Thank you @ALL, not just for this, but also for all the other improvements! Also big thank yous for things that don't show up on the map, but make it easier to make it better (JSON, Yaml, ??)

@matthijsmelissen
Copy link
Collaborator Author

I would like to thank everyone for their comments. Sorry for not responding to them earlier.

Mt. Baker - Snoqualmie National Forest isn't showing up.

Not sure what the problem was, but on the production server, it works fine.

Iron Valley Golf Course lost label on z14

See #1046.

Is this possible? Could we try to place all the size labels?

Yes, with text-placements, but not in the current Mapnik version, or by triplicating the layers, but I think that would have a huge performance and code-maintenance penalty. Do we want this?

tourism=attraction [..] I strongly prefer current rendering

See #1047.

Universities should have labels that are not disappearing so easily.

See #1048.

Another example of object deserving a bigger label - Błonia https://api.openstreetmap.org/way/25113592

In my opinion, the label size is fine there.

the typical mapnik labeling problems like the random appearance/disappearance of labels

See #1026.

It would probably make sense to integrate the waterbody labeling which is currently based on static way_area thresholds into this framework.

Yes, this is one of the next steps.

The glacier label color is somewhat greenish

See #1016.

The glacier labels now turn up later in general compared to the previous thresholds,

See #1031.

is it possible that previously glacier labels were prioritized over peaks and with this change they no more are?

Yes, glacier labels are no longer prioritized over symbols (just like other labels). #1046 should solve this at least partially.

For some big industrial areas, it can happen that the font size of the landuse label ("Hafen") is bigger than the font size of the label for the town ("Rheinau") it belongs to.

It seems the harbour here is also larger than the town... Do you propose rendering either towns larger or landuse labels smaller?

Sometimes labels collide with street names and are not rendered therefore.

Correct. In general, I think missing street names are a larger problem when navigating.

For big forest areas that are mapped as a multipolygon, it can happen that the label for the same forest appears several times in different sizes.

True. Not sure what to do about this.

I also found a lot of cases where town names are rendered twice, because the residential area has a name tag as well.

At least the Dutch community seems to be of the opinion that this is a tagging problem.

The only thing that needs tweaking IMHO is university labels, see above and also here

See #1048.

If there is anything people feel deserves more attention, feel free to open a new issue. And sorry for my telegram-style response, but there was just a lot to respond to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment