Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

pixel snapping for shield symbolizer? #1866

Closed
springmeyer opened this Issue May 25, 2013 · 8 comments

Comments

Projects
None yet
2 participants
Owner

springmeyer commented May 25, 2013

Need to consider pixel snapping for shields as well as markers (as per #1316).

But current dumb approach leads to more blurry shields in some cases, which is likely resulting from some conflict between other code trying to round to integers.

Needs a closer look.

With the patch from #1316 I have a strange rendering of my new SVG road shields:
_pixel_snapping_issue_with_patch
The right white side looks good, but all other sides looks too thin or blurry, actually.

Owner

springmeyer commented May 25, 2013

can you post before/after?

This one with no patch:
_pixel_snapping_issue_without_patch

Owner

springmeyer commented May 25, 2013

thanks. so are you customizing the scale_factor you are rendering with at all? Also, can you post your shield icon?

No, I'm not using scale_factor setting at all.
Maybe Mapnik have a problem with parsing some SVGs. Because my town markers looks great (when rendered with MarkersSymbolizer or patched ShieldSymbolizer), but my shields not.
This shield was used in images above (with transform="scale(1.2)" parameter in XML):

<?xml version="1.0"?>
<svg width="17" height="10" xmlns="http://www.w3.org/2000/svg">
 <g>
  <title>Layer 1</title>
  <rect id="rect1" width="17" height="10" rx="2.5" fill="#0090ff"/>
  <rect id="rect2" x="0.25" y="0.25" width="16.5" height="9.5" rx="2.25" fill="#ffffff"/>
  <rect id="rect3" x="1.25" y="1.25" width="14.5" height="7.5" rx="0.25" fill="#0090ff"/>
 </g>
</svg>

Actually, I adjust it for MarkersSymbolizer rendering. Perhaps it was wrong in this case.

And this is a town marker used in #1316 (comment) images (with transform="scale(0.7)" parameter, 0.3—0.6 factors also was used and all looks great):

<?xml version="1.0"?>
<svg width="10" height="10" xmlns="http://www.w3.org/2000/svg">
 <g>
  <title>Layer 1</title>
  <circle fill="#ffffff" stroke="#000000" stroke-width="1.0" r="4.5" cy="5.0" cx="5.0" id="town"/>
 </g>
</svg>

Oh, in Opera browser this shield looks the same as in Mapnik rendered by ShieldSymbolizer with the patch or with MarkersSymbolizer:
_shield_in_opera
Note: scaled directly in Opera by setting the scale of 120 %.

@springmeyer springmeyer self-assigned this Jul 30, 2014

Owner

springmeyer commented Aug 5, 2014

note to self: need to move on this after making sure that test coverage for shields is good enough.

I think if MarkerSymbolizer uses pixel snapping then ShieldSymbolizer should use pixel snapping too.

P. S.: Mapnik on all our servers are patched with https://gist.github.com/springmeyer/5650582 and we are happy with the result.

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