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

Unpaved rendering for turning circles #4770

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sommerluk
Copy link
Collaborator

Changes proposed in this pull request:

  • Currently, unpaved turning circles are rendered as if they were paved. This PR renders them actually as unpaved.

Test rendering with links to the example places:
https://www.openstreetmap.org/#map=19/6.53649/2.40256

Before
before

After
after

@@ -611,8 +611,14 @@ Layer:
<<: *osm2pgsql
table: &turning-circle_sql |-
(SELECT DISTINCT ON (p.way)
p.way AS way,
-- Valid line geometry requires at least two points that are NOT identical, therefore moving them slightly.
ST_MakeLine(ST_Translate(p.way, -0.0001, -0.0001), ST_Translate(p.way, 0.0001, 0.0001)) AS way,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like generating fake lines. Why can't we use a point and crop out an appropriately sized circle from the unpaved pattern?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would mean cutting about 30 different circular SVGs from the patterns. And you would still get a discontinuity of the pattern rendering at the transit from the turning circle to the linear road.

The other alternative would be using ST_Buffer() + polygon pattern, but that would require the road width progression to be available in SQL. On the other hand, that would allow merging the turning circle and highway area layers and this way could reduce size of roads.mss quite a bit...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @imago explained, using a point geometry

would mean cutting about 30 different circular SVGs from the patterns

Therefore, I think what is proposed in this PR is easier in code and maintenance.

@dch0ph
Copy link
Contributor

dch0ph commented Jan 16, 2025

It might seem in slightly poor taste to highlight this PR following the recent changes in maintainers, but ...

I don't see a problem in creating a fake line to address a rendering issue - it's not as though the underlying data(base) is being manipulating.

The other alternative would be using ST_Buffer() + polygon pattern, but that would require the road width progression to be available in SQL.

Or is this a more promising long-term direction? I was wondering about how you might render passing places, but this would involve a lot of MSS code duplicating the road width progression, which would be avoided if the road width were evaluated in SQL.

@imagico
Copy link
Collaborator

imagico commented Jan 16, 2025

I don't see a problem in creating a fake line to address a rendering issue - it's not as though the underlying data(base) is being manipulating.

I don't think it is a particularly elegant solution but i also don't have principal objections against that.

Background is that rendering line features with a polygon-like 2d fill pattern was a late addition to Mapnik - and it was done selectively for line features, not as a generic feature to be able to use a 2d pattern for anything that would otherwise be shown in a plain color. The need to also allow this for other features (in particular marker symbolizers and SVG symbols) was discussed in mapnik/mapnik#3977 - but never implemented. The choice by @sommerluk for using fake lines is likely based on the realization that this would not happen and we need to use a workaround of some kind.

The three principal solutions for that have been mentioned already:

  1. using a very short artificially generated line string and rendering that like the road lines with a 2d pattern and round line caps - somewhat awkward on the code level but still fairly strait away, visual results without issues.
  2. script generating circular cutouts from the patterns as SVGs and using those in rendering. This is much more complex to implement and maintain and will be visually inferior because the patterns of road lines and turning circle will not match.
  3. using ST_Buffer() + polygon pattern. This is somewhat complex to implement because it requires the road width progressions to be available in SQL. It could still be beneficial as part of a general re-design of the road layers - which i, however, don't see happening as a volunteer project (this would be a multiple months effort requiring in-depth knowledge and it would be unclear if that would be ultimately of benefit under our goals).

Among these option i see the first clearly as the most viable one. This would not rule out moving to the third in case a larger road rendering re-design should be pursued by someone in the future.

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

Successfully merging this pull request may close these issues.

4 participants