-
Notifications
You must be signed in to change notification settings - Fork 826
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
Predictable offsetting on polygons #2851
Comments
@pnorman - thanks, and can you explain how you think it is working currently? Basically v2.2.0 does not change the winding/orientation of the polygons, so it works.... but do you find that the orientation of polygons is consistent coming out of PostGIS? If so, do you know how they are consistent? Is |
There is no geometry manipulation going on in PostGIS, everything is directly as it comes out of the DB. I've never worried about winding order when developing stylesheets. I can see if I can produce an example which has a reasonable number of points, not the 100+ that most nature reserves have. |
I imported a DB I could freely mess around with and turned all buildings into nature reserves with Every building rendered as an inside-out reserve. Dumping out from psql shows that one I looked at is in the RHR SELECT
ST_AsText(way),
ST_AsText(ST_ForceRHR(way)),
ST_AsText(ST_Reverse(ST_ForceRHR(way)))
FROM planet_osm_polygon WHERE osm_id = 107269688;
Doing a check with SELECT
DISTINCT ST_AsText(way) = ST_AsText(ST_ForceRHR(way)) AS IsRHR
FROM planet_osm_polygon; finds all polygons in the polygon table are RHR. If I flip a building with |
|
2.2.0 is consistent and 3.0.0-rc2 is consistent (on a given coordinate system). They just don't agree with each other. If I flip which side it tries to draw on, then it will break the style on 2.2.0. |
@pnorman I thought that in 2.2.0, they were not consistent, and depended on the winding order of the source data. |
After testing, yes, this is correct. But the standard osm2pgsql toolchain has a consistent winding order, and with that winding order, it ends up reversed in 3.0 One workaround would be to reverse the side in the style and change the SQL to (SELECT
ST_Reverse(way) AS way,
name,
tourism
FROM planet_osm_polygon
WHERE (tourism = 'theme_park'
OR tourism = 'zoo')
AND way && !bbox!
) AS tourism_boundary This is a bit of an ugly hack. |
@pnorman Which way is the line-offset "negative" and "positive". "negative" = inward? "positive" = outward? |
They have a negative line-offset to get a line farther inside than normal. This is consistent with ST_Buffer, where negative shrinks. I'd just flip 3.0.0 behavior. It will get it consistent with ST_Buffer (positive being bigger) and get it consistent with osm2pgsql + Mapnik 2.2. It does mean that anyone using a different data loading toolchain which loads in polygons with a left-hand rule will have to flip their offset and use ST_ForceRHR, but I believe that is fewer than who are using osm2pgsql and offsets. |
#2834 introduces a problematic back compatibility problem for cartographers using
line-offset
on polygons because it will potentially flip the side of the polygon that the offset occurs on.This may be a serious blocker for people upgrading to Mapnik 3.0.0.
Let's brainstorm solutions...
refs gravitystorm/openstreetmap-carto#481 (a bug report for #1382 but also proof of people using offsetting on polygons)
The text was updated successfully, but these errors were encountered: