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

Render strokes in real world units #3988

Open
jerry73204 opened this issue Sep 12, 2018 · 2 comments
Open

Render strokes in real world units #3988

jerry73204 opened this issue Sep 12, 2018 · 2 comments

Comments

@jerry73204
Copy link

Is it possible to render the stroke width in meters, feets? The rendered pixel width depends on zoom and projection. I see an example from GeoServer. It does so by specifying uom.

If mapnik cannot work it out, as an alternative, is it possible to transform a linestring to polygon?

@talaj
Copy link
Member

talaj commented Sep 12, 2018

It's not as straightforward as writing stroke-width="10meters", but it is possible.

One way are render-time variables. It is possible to pass a variable to the rendering, let's say a variable @pixels_per_meter and then write a line style such as

<LineSymbolizer stroke-width="10 * @pixels_per_meter">

In postgis, pgraster and newly in sqlite datasources, there are placeholders !pixel_width! and !pixel_height! that you can use in a query

select 10 / !pixel_width! as road_width

and use in style like

<LineSymbolizer stroke-width="[road_width]">

@jerry73204
Copy link
Author

Thanks @talaj. The reply is informational.
I found postgis' ST_Buffer and ST_OffsetCurve maybe a good alternative.

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

2 participants