-
Notifications
You must be signed in to change notification settings - Fork 829
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 of amenity-points #2597
Conversation
I think this goes in the right direction. Let me know when it is ready for review. |
You could try my idea of using vertical-alignment=top (#2248) |
@HolgerJeromin I'm not sure if this would still be needed with shields as the position of the image does not affect the position of the text, so the icon cannot block the text. |
Yes, an icon cannot block the text, but we can have different distances between the icon bottom and text top. Large text can result in smaller distance than small text heights. BTW shield-vertical-alignment-keyword differs here from the normal align that it defaults to |
Yes of course. It's a bit hidden because there are so many changes, but the reduction of dy for the generic shop is already there: https://github.com/nebulon42/openstreetmap-carto/blob/27bc13cc8f51f42c04abefa48ce08294725fe7f7/amenity-points.mss#L782. |
a8fdcac
to
fdb6d26
Compare
@math1985 This is now ready for review. I have not touched the low-priority layer. And I have a few questions regarding it:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I focused on reviewing the output, not a line-by-line review, and this looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're moving the coloring of the icons from the stylesheet to the SVGs. It was once a deliberate choice to do the colorings in the stylesheet, for easy customization. Would this rewrite also be possible without coloring the SVGs directly?
No, unfortunately not. The ShieldSymbolizer does apparently not support SVG re-colouring otherwise I would have used it. It is not ideal, but as I wrote above customization is still possible if no shields are used and otherwise by altering the colours in the SVGs directly. This can also be automated by using sed or any other search and replace utility. For me the improvements of the shield approach outweigh the downside of having the colours in the SVGs. |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool work! I'm still a bit sceptical if this is going to work out or not in the end though.
If I understand correctly, labels will now be given priority over icons. I'm not sure if that's an improvement. In Luxembourg, I have seen cases where, on z17, a single bank label is blocking four restaurant icons.
Some other issues:
- Airport labels are not longer italic
- Lowzoom airport icons are colored wrong
marker-file: url('symbols/shelter.svg'); | ||
[feature = 'tourism_alpine_hut'][zoom >= 14], | ||
[feature = 'tourism_wilderness_hut'][zoom >= 14], | ||
[feature = 'amenity_shelter'][zoom >= 17], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to change the zoomlevels for alpie hut, wilderness hut and shelter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like if I did, but for z13 (alpine hut, wilderness hut) and z16 (shelter) the markers do not have text, so they are in the "markers without text" category.
shield-text-dy: 11; | ||
shield-unlock-image: true; | ||
|
||
// second pass for icons without text where there is still space |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice approach!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
shield-fill: @transportation-text; | ||
shield-text-dy: 9; | ||
a/marker-file: url('symbols/bus_stop.12.svg'); | ||
a/marker-fill: @transportation-icon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need those marker-fill lines after recolouring the icon files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking we don't but I wanted to keep those as we did have them before. But when I think about it it is redundant and probably should be removed. Should I?
a/marker-file: url('symbols/museum.svg'); | ||
} | ||
[feature = 'man_made_mast'] { | ||
shield-file: url('symbols/communications.svg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this one has a shield-fill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should.
a/marker-file: url('symbols/windmill.svg'); | ||
} | ||
[feature = 'amenity_hunting_stand'] { | ||
shield-file: url('symbols/hunting_stand.svg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing shield-fill? If so, could you please double-check all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
amenity-points.mss
Outdated
} | ||
[feature ='amenity_fountain'][zoom >= 17] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace typo
amenity-points.mss
Outdated
} | ||
[feature ='amenity_fountain'][zoom >= 17] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably miss something, why can we not handle fountain in the generic way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem was the layering of nozzle and pool. It required marker-allow-overlap
to display both layered above each other. The downside to this approach is that it also allows other markers to overlap with them which happened frequently. (see #1934)
} | ||
} | ||
|
||
// markers without text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly dislike the duplication here, can we not solve this differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how a shield without text behaves and we would still have the text-dy which probably takes up space even if name is empty. I'm also not sure if a shield symbolizer uses more resources so it might be not good to use it unnecessarily.
But I'm open to other ideas.
Another option would be to solve this cartographically by not having POI icons where their label shows up at later zoom level. But I would be against that.
@@ -1646,6 +1646,8 @@ Layer: | |||
'laundry', 'dry_cleaning', 'beverages', 'perfumery', 'cosmetics', 'variety_store', 'wine', 'outdoor', | |||
'copyshop', 'sports', 'deli', 'tobacco', 'art', 'tea', 'coffee') THEN shop | |||
ELSE 'other' END AS shop, | |||
name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff of the changes in this file is a bit hard to read, what do we change exactly in this file?
Is it still necessary to have a separate text layer in addition to the amenity-points layer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the name attribute (and other necessary ones for text rendering) to the amenity-points queries. At the same time I removed the now unnecessary parts of the text layer queries. Those are still needed, because there are other text features (e.g. water related) that also use the queries.
f15fcb1
to
92e3014
Compare
I have adressed the points raised:
I did not see this. Could you show an example? Thanks both for the thorough review.
To be a bit more specific labelled POI or those without rendered label now come first and then the remaining space is filled with icons where possible. But the rules are now more straightforward, before it was rather arbitrary. z17 is still quite crowded in cities even after your shop rendering change. Another thing I could think of would be to penalize long names somehow so that too long names do not block too many icons. But this was just an idea, I would have to think about how to do that. |
I have not had time to test this but am i right to assume that this change does not solve the long time problem of symbols frequently vanishing and later re-appearing as you zoom in because symbol priorities are not strictly in order of the starting zoom level? If this is not the case is this change at least neutral in that regard or does it make this problem worse? |
It definitely does not solve the problem and I would expect that this change is neutral towards this. |
No, this has nothing to do with metatiles. The problem occurs if at a certain zoom level new symbols start to be shown - and are rendered with higher priority than symbols that already show at a lower zoom level. |
Yes, so I thought sorting the rules by lowest zoom level would help but this was not the case for a instance of this problem. The only places where I found vanishing symbols in my test rendering were metatile boundaries. But since my Kosmtik rendering suffers from cut-off things at these boundaries anyway this might be something else. I thought if the buffer overlap is not sufficient collisions there are more likely. |
Vanishing symbols with zoom variations should happen when either there's a change in label collisions interactions, or you have two things which collide and on the one rendered at lower zooms appears later in the query results at higher zooms. Because I don't think we order the amenity queries by tagging at all, this PR is probably no change to that. |
As this has cartography changes, this PR is currently held up by the feature freeze until 4.0.0 has been released. |
@nebulon42 Can you give some example before/after renderings of a densely mapped city in your area? It might help us to determine whether the disappearance of the label-without-icon-problem offsets the lesser amount of shops shown. |
60135b5
to
9f9c332
Compare
…s, a second pass of only icons fills up free space, dy was harmonized, restructuring of code to avoid repetition, fixes gravitystorm#234
Since we now require carto 0.18 I have updated this to use a feature of carto >= 0.17.2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this can't be backported to 3.x with the use of none
, it can't be merged until at least two MINOR releases have occured.
@pnorman Yes, I know. But it can be manually backported without using this feature with minimal effort. I'm willing to do this once merged to master. |
Thanks for the previews! Unfortunately, in the new rendering quite a lot of information is lost by icons that are blocked by labels and cannot be rendered. This plays especially on z18 (mainly in the second example) but also in z17 (for example the Jewish museum). The main problem this is solving, labels without icons, seems quite rare. If I'm not mistaken, we have no single instance of this happening in the previews. I therefore think this PR is not an improvement - even though it's very cool from a technical perspective. |
There are definitely changes in labelling and some labels block other icons. But I would not use "a lot of information". One way to tackle this could be to introduce a length limit for labels. When this is exceeded the process is reversed and first icons without label are placed and after that icons with label. But probably this gets to complex and is not worth it. It remains to be decided if the gain in consistency and reduction of complexity is worth those changes in rendering. |
This uses the same technique as gravitystorm/openstreetmap-carto#2597 of a shield symbolizer to place icons+labels, then a marker symbolizer to try just labels. This ensures that there is never text without labels, and textless labels can fill in empty room.
Before I'm going through the hassle of rebasing and resolving the conflicts I'd like to sort out the question if it is worth to go on or not. @math1985 I respect your opinion, but I'd like to hear from other maintainers what they think about the problem with icons blocked by labels. Apparently @pnorman used the technique in another project so I'm curious what he thinks about that. |
It works well, and it's the best technique I know of. The limitations I found were
The only overall improvement I'd make is to use a name like I'd be okay merging it, except I'd have to resolve the conflicts, and handle the backporting to 3.x. |
@pnoeman You're aware of the drawbacks I pointed out right? |
@pnorman You're aware of the drawbacks I pointed out right? |
I had missed those.
I'm just not seeing this when I look at the previews. I see different stuff being rendered, but no overwhelming trends. Perhaps there's some adjustments we can make to the margins to allow labels to be closer? |
I'm tired of this. |
What are you tired of exactly? If it's about my comments, you have my full blessing to go ahead with this if that's what you think is best for the project. |
Also, is there anything we can help you with? |
:) It's just that I would have had to resolve the merge conflicts and I saw what has changed and it was just a mess. So I decided not to do it, I do not have the energy to keep this up to date with master. |
Fixes #234, #1640.
Improvements
Caveats
sed
or similar