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

Cyan colour at z6 #73

Closed
pnorman opened this issue Jun 18, 2013 · 14 comments · Fixed by #878
Closed

Cyan colour at z6 #73

pnorman opened this issue Jun 18, 2013 · 14 comments · Fixed by #878

Comments

@pnorman
Copy link
Collaborator

pnorman commented Jun 18, 2013

6/14/25 on orm
25

See the cyan colour near Oklahoma City. I suspect it has something to do with small water areas based on where I'm seeing it.

This issue is not present on yevaud, there it is a gray colour. Neither strikes me as visually great, but the cyan is worse.
6/14/25 on yevaud
25

@gravitystorm
Copy link
Owner

That's a mapnik upgrade thing, I suspect - I saw a similar problem with a client of mine but we eventually moved on with a workaround. If someone could confirm it with the old stylesheets and new mapnik (2.1+) that would be great.

@matthijsmelissen
Copy link
Collaborator

This bug is still present: http://c.tile.openstreetmap.org/6/14/25.png

@matthijsmelissen
Copy link
Collaborator

It is now also present on yevaud.

@pnorman
Copy link
Collaborator Author

pnorman commented Jun 11, 2014

Maybe a way_area > some fraction of a pixel's area? I know that where clauses on way_area are a bad idea, but we kind of need something

@Rovastar
Copy link
Contributor

Why do you need a "where" clause in the SQL?

Something like

   [natural = 'lake']::natural,
   [natural = 'water']::natural,
   [landuse = 'reservoir']::landuse,
   [waterway = 'riverbank']::waterway,
   [landuse = 'water']::water {
  [way_area >= 15000][zoom >= 6],{
       polygon-fill: @water-color;
       polygon-gamma: 0.75;
 }
 [[zoom >= 8],{
 polygon-fill: @water-color;
       polygon-gamma: 0.75;
     }

Or whatever size you see fit. And obviously you will need to fix the syntax but you get the idea.

edit: or that that what you mean shrug is it really a large overhead for that!?

@pnorman
Copy link
Collaborator Author

pnorman commented Jun 11, 2014

It doesn't matter if you do the way_area check in MSS or in SQL, you still shouldn't generally filter by area. I think it's okay in this specific case, but in general it can lead to stuff like stretches of rivers disappearing, because they can be split in arbitrary ways.

@Rovastar
Copy link
Contributor

I did consider the riverbank issue and was going to leave it out,

Personally I think the way to go is to use way_area on a load of features. I would like to see on nearly everything. The larger the area of a hospitals, airports, schools, retail parks, etc, etc render the name/area dependant on the size. Small ones would not have a name rendered at x zoom level large ones would. It gives really meaningful rendering. As most of the time teh larger an area the more important it is.
As long as the rendering time is not additionally huge I would be a great fan of this.
Being the performance stats guru on this do you what the impact is if we did say 100 of these checks.
I don't see this is much different to adding another condition.

@imagico
Copy link
Collaborator

imagico commented Jul 4, 2014

The cause of the cyan color is that the gamma setting is messing with the color mixing in the renderer (without actually knowing what mapnik does internally but this is a pretty safe guess) . So you would not need to leave out small water areas completely, just use standard gamma for all smaller ones and only manipulate the gamma for areas at least a few pixel in size. This would also be an improvement independent from the color issue since the manipulated gamma setting overemphasizes the water (i.e. there appears to be more water than there actually is).

matthijsmelissen added a commit to matthijsmelissen/openstreetmap-carto that referenced this issue Aug 8, 2014
Don't render tiny water areas (4px or less).

This should resolve gravitystorm#73.
@pnorman
Copy link
Collaborator Author

pnorman commented Aug 11, 2014

mapnik/mapnik#1639 is relevant too for size thresholds

pnorman added a commit to pnorman/openstreetmap-carto that referenced this issue 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 issue Aug 12, 2014
@mrwojo
Copy link
Contributor

mrwojo commented Aug 13, 2014

I stepped through this yesterday to confirm specific issues (which I can expand upon if you want the gory details):

  1. 99.9% of the natural=water polygons in the 6/14/25 tile have way_areas smaller than a pixel

  2. subpixel geometry is not exactly modeled in AGG
  3. the small polygons cluster at the minimum coverage value representable in AGG (8-bit)
  4. pow(0.75) gamma has its most distorting positive effects on the low end -- min coverage polygons have 4x alpha
  5. truncation from multiplying 24-bit color values by a tiny alpha value reduces hue precision -- reducing to options like cyan or gray
  6. accumulating many subpixel polygons magnifies the precision issues

Tweaking the gamma by setting a cutoff size >1 pixel would effectively hide this by making subpixel polygons not noticeably affect the rendering. However, a large water body represented by many subpixel polygons would still render poorly due to points 2 and 5 above. For these reasons, I'd be more inclined to simply filter out very small polygons in SQL (significantly smaller than one pixel). The net effect is almost identical and it results in a significant performance improvement for this tile locally.

"Outside the osm-carto box", AGG (or at least Mapnik's use of it) would need a few updates to support higher precision rendering. Personally, I think that'd be a little overkill if we're willing to just make this problem go away by filtering.

@pnorman
Copy link
Collaborator Author

pnorman commented Aug 13, 2014

@springmeyer, @artemp, any thoughts on this? Ultimately we'll need to do something in osm-carto, but is there an upstream issue in mapnik/mapnik?

@springmeyer
Copy link

simply filter out very small polygons in SQL (significantly smaller than one pixel). The net effect is almost identical and it results in a significant performance improvement for this tile locally.

👍

@springmeyer, @artemp, any thoughts on this? Ultimately we'll need to do something in osm-carto, but is there an upstream issue in mapnik/mapnik?

Upstream issue for what exactly? It is not clear to me there is a bug. If this is important I would recommend experimenting with the other gamma-methods AGG has which Mapnik exposes: https://www.mapbox.com/carto/api/2.3.0/#polygon-gamma-method and after the creating a standalone testcase.

@pnorman
Copy link
Collaborator Author

pnorman commented Aug 27, 2014

Upstream issue for what exactly?

Drawing cyan as a result of the truncation scenario outlined by @mrwojo

@matthijsmelissen
Copy link
Collaborator

Can confirm this is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants