Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

scale_factor must apply to ShieldSymbolizer "minimum-distance" and text "dy" #1766

Closed
zeesource opened this Issue · 28 comments

3 participants

@zeesource

The scale factor parameter to renderer currently scales the fonts and lines, etc., but does not scale the "minimum-distance" parameter for ShieldSymbolizer and "dy" for text symbols.

This can result in higher scale images having more closer placed shield symbols than lower scaled images. For example, in the attached images when the scale factor is set to 1.0 (top image), we see three shield symbols for highway 20, while we see 5 symbols for scale factor set to 4.0 (bottom image).

Scale-1-0
Scale-4-0

@springmeyer
Owner

could you provide details on all your shield symbolizer options? Ideally paste an XML snippet.

@zeesource
@springmeyer
Owner

okay, thanks. So I am short on time this week and I yet to come up with a small testcase (data + styles) that I could replicate with, which is needed for the visual_tests before I can check in a fix. It may be till next week that I will have time for this.

@zeesource
@zeesource

Hi Dane, just checking in. Any progress on this issue? Let us know if we can provide any assistance.

@springmeyer
Owner

@zeesource - yeah, you could help by putting together a testcase on your end.

@zeesource

@springmeyer thanks. Will do. Let us know if you have some samples that we can use as reference, otherwise we'll try to create from scratch.

@springmeyer
Owner

@zeesource - that is the issue, my simple samples/testcase data are not able to trigger this issue.

@zeesource

@springmeyer strange. We are not able to trigger the issue on a small sample as well. Any thoughts?

@springmeyer
Owner

@zeesource - is your sample tiled? It may be that the interplay of tile size impacts as well. My attempts at a reduced test case where not tiled either, so my hunch is that they need to be.

@zeesource

No, the sample is not tiled.

I tried with an image of size 500 x 500 at scale 1.0, and got 5 shield symbols in my test case.

Then, I tried it with an image size of 1000 x 1000 at scale 2.0, and still got 5 symbols with nothing else changed.

Similarly for scale 4.0 and 8.0.

Don't understand how tiling would make a difference?

@zeesource

@springmeyer Do you know how Mapnik calculates the distance for the "spacing" parameter of ShieldSymbolizer? Does it calculate along the route, or does it take a straight line distance between the shields?

We've been using straight line routes in the sample, and I'm wondering if we should try out a curving route.

@springmeyer
Owner

@zeesource - it should be calculating the length along the line, taking account of each vertex in the line.

@springmeyer springmeyer was assigned
@zeesource

@springmeyer We've come back to this issue, and have been doing some additional experiments. Looks like it might be the minimum-distance parameter which could be the issue, not the "spacing" parameter in ShieldSymbolizer?

@springmeyer
Owner

possible. minimum-distance can be confusing (see #995). Any progress on a test case to replicate yet?

@zeesource

Thanks. Will work on getting a test case. Wanted to first check with you if this is a good path to follow.

@springmeyer
Owner

thanks, look forward to seeing the testcase. Please try to avoid having it depend on a database - shapefiles or geojson are better.

@zeesource

@springmeyer no luck...minimum distance is being respected correctly at different scales in the simple case.

@zeesource

@springmeyer I've put the sample that we've been using at: http://www.zeesource.net/issue1766/sample.zip

We can work on this to try to replicate the issue.

@springmeyer
Owner

I'm out of the office through next week. Let me know if you make progress on replicating. I may try again myself late next week or the following.

@support4net

Hi,
I'm having a little problem understanding how to test this feature. I understand how it works but I'm trying to pass the scale_factor="4" inside the XML style. I tried inside the Map, Layer, TextSymbolizer, ShieldSymbolizer but no effect. Probably I misunderstood the hole idea behind the render process...

@springmeyer
Owner

Thanks for your interest @support4net. scale_factor is not an XML style option. Rather it is passed into the agg_renderer. The exact api depends on how you are calling mapnik. If from python then scale_factor is an optional 3rd argument to mapnik.render, see: https://github.com/mapnik/mapnik/blob/2.3.x/tests/python_tests/render_test.py#L221-L236

@support4net

@springmeyer Dane,
Thank you for explaining me how it works. In deed I had a different idea about how it works.
I imagined that I can supply the param in the XML file for each symbolizer in such way that I can increase the clarity of those entities in the image, such as road shields, village names, POIs , but not other like water , forest, etc that do not require too much attention. The selective scale_factor I still think is a great idea for a future development if this is technically possible....

Now that you offered me this information I understand that I should use a python renderer to seed my maps but I don't know if TileStache will do that for me without altering their code.....

@springmeyer
Owner

I imagined that I can supply the param in the XML file for each symbolizer in such way that I can increase the clarity of those entities in the image, such as road shields, village names, POIs , but not other like water , forest, etc that do not require too much attention.

No, scale_factor is a global option a render time, not per symbolizer. If you want more control per symbolizer I recommend checking out CartoCSS: https://github.com/mapbox/carto

The selective scale_factor I still think is a great idea for a future development if this is technically possible....

I disagree. This is best solved outside of Mapnik, and before by pre-processing the stylesheet. See CartoCSS.

@springmeyer springmeyer removed this from the Mapnik 3.x milestone
@springmeyer
Owner

Update on the original issue via @zeesource. Without a testcase I can't replicate and therefore can't move forward.

I can confirm that:

A number of good new visual tests were added in 801848a and might be a place to start if anyone things this is still an unresolved issue and is able to find a way to replicate.

@springmeyer springmeyer added this to the Mapnik 2.3.0 milestone
@springmeyer
Owner

Also #2381 might be related to what was lead to this issue.

@zeesource

@springmeyer Thanks. Yes, unfortunately, it was not possible to get a test case, so probably some complex interaction with other aspects of the map. Will upgrade Mapnik and see if #2381 gets a better visual for shield placements with higher scale factors. Appreciate all your work on this.

@springmeyer
Owner

@zeesource yes, <DebugSymbolizer /> can help spot the bug and help you understand its actually something unexpected :) When you have time also give Mapnik 3.x a shot - much of the placement code is re-written in Mapnik 3.x and works better and faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.