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

Don't render tiny water areas #867

Conversation

matthijsmelissen
Copy link
Collaborator

Don't render tiny water areas (4px or less).

This should resolve #73.

Don't render tiny water areas (4px or less).

This should resolve gravitystorm#73.
@imagico
Copy link
Collaborator

imagico commented Aug 8, 2014

That is a bad idea for reasons discussed in #703. You would introduce bias and outright rendering errors (in particular interrupted rivers) this way. I explained in my comment on #73 how the cyan color issue can be solved more elegantly.

@pnorman
Copy link
Collaborator

pnorman commented Aug 8, 2014

👎, this will cause parts of rivers to disappear.

I could see going for way_area/(!pixel_width!*!pixel_height!) => 0.1 or so as an area << 1 pixel is probably safe to not render, but I doubt that will have a huge impact on #73.

@vholten
Copy link
Contributor

vholten commented Aug 9, 2014

I loaded Oklahoma and tested which threshold value is required to hide the cyan color. I found that way_area/(!pixel_width!*!pixel_height!) > 0.001 is sufficient. This will probably not cause problems with rivers.
Example images:

way_area/(!pixel_width!*!pixel_height!) > 0.001
new 0 001

way_area/(!pixel_width!*!pixel_height!) > 0.0001 (just to show that this threshold is too small):
new 0 0001

@matthijsmelissen
Copy link
Collaborator Author

@imagico, thanks, closing this one.

@matthijsmelissen
Copy link
Collaborator Author

Great test! Do you have a way to test which value causes river problems too?

@vholten
Copy link
Contributor

vholten commented Aug 9, 2014

I don't see any river problems in my Oklahoma test. With my suggested threshold, only river parts smaller than one thousandth of a pixel would be hidden, and these parts are probably not observable even if they are shown.

@daganzdaanda
Copy link

Wow, the possibilities of Carto-CSS are impressive!
This may be a stupid question, but could a calculation like this be useful for more things? Are calculations like these taking a lot of time / processing power?
If anything is so small that it would only be less than 1/1000 (or even 1/10) of a pixel at a certain zoom, why should it not be dropped from rendering at that zoom? If you zoom in, it will get bigger and then it makes sense to render it, but why waste ressources trying to display something that is invisible anyhow?

(Of course, the gamma issue that @imagico mentions should be looked into anyway.)

@matthijsmelissen
Copy link
Collaborator Author

I think this might potentially also be useful for landcover.

@matthijsmelissen
Copy link
Collaborator Author

Does anyone understand the rendering algorithm by the way? Why would an area of 0,001 with non-zero gamma lead to a cyan pixel?

@daganzdaanda
Copy link

Wild guess: anti-aliasing gone bad?

@imagico
Copy link
Collaborator

imagico commented Aug 11, 2014

@math1985 - the exact mechanism how the cyan color is produced eludes me, this could be some kind of accumulated rounding error (i.e. a bug) or a perfectly normal side effect of the gamma manipulation. Generally this whole gamma thing is a really ugly way to work around a systemic limitation of the rendering framework. The gamma parameter is originally not intended to be used this way, it is meant for optimizing antialiasing for specific characteristics of the output device (see http://www.antigrain.com/research/gamma_correction/). The way it is usually used in mapnik actually reduces antialiasing quality so it is more or less used against its original intent.

And limiting the gamma manipulation to larger polygons works fine, here for example with a limit of 0.1 pixel polygon size:

Standard gamma for small water features

pnorman added a commit to pnorman/openstreetmap-carto that referenced this pull request Aug 12, 2014
polygon-gamma was left over from the XML conversion, and doesn't actually
seem to help anything

Fixes gravitystorm#73
Superceeds gravitystorm#867
@pnorman pnorman mentioned this pull request Aug 12, 2014
@matthijsmelissen matthijsmelissen deleted the no-tiny-water-areas branch September 25, 2014 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cyan colour at z6
6 participants