opennewzealand / linz2osm

Some tools for helping move LINZ data into OpenStreetMap
http://wiki.openstreetmap.org/wiki/LINZ
GNU General Public License v3.0
23 stars 2 forks source link

Reverse direction of aquatic ways #19

Closed HamishB closed 14 years ago

HamishB commented 14 years ago

Hi,

For correct rendering OSM wants land/water polygons to be directional so that water is found on the right side of the way and land on the left.

see http://wiki.openstreetmap.org/wiki/Tag:natural%3Dland http://wiki.openstreetmap.org/wiki/Tag:waterway%3Driverbank http://wiki.openstreetmap.org/wiki/Tag:natural%3Dcoastline#Direction

Thus we need a way to earmark some _poly layers in order to tell osm.py to reverse the [inner &] outer polygon directions: river_poly, lagoon_poly, and lake_poly (maybe more?). For the Chatham Lagoon upload I just reversed them all by hand (70+, PITA, hope I got 'em all). The island_poly layer is "positive" so currently in the right direction.

cheers, Hamish

HamishB commented 14 years ago

I suppose as a general solution each layer's setup page could get a Reverse ways tick box to flag that they need it.

pond_poly, glacial lake poly, and cliff_edge polyline also need this.

rcoup commented 14 years ago

so is it good practice to just export every *poly layer with clockwise orientation (and anti-clockwise for the holes)?

rcoup commented 14 years ago

hmm. apparently not - coastline should be opposite. http://wiki.openstreetmap.org/wiki/Tag:natural%3Dcoastline

What's the common case, and lets make an exception for the weird ones?

HamishB commented 14 years ago

If I had to choose, I would call 'land' the common case (CCW).

I was thinking about a general "tickbox" solution with the idea that much of the PostGIS->OSM online groupware framework you are building here might also be very useful to e.g. the recent/ongoing British's ordinance survey office data release and future merges of that data by other people, and so try to avoid introducing local hacks...

HamishB commented 14 years ago

also, I think it is probably bad to force a direction on things needlessly. Layers like river_cl, boatramp_cl, and cliff_edge seem designed with direction already, it would be a shame to clobber that information with a uniformity-scrubber.

rcoup commented 14 years ago

Tickbox solution is sweet - will figure something out. This all only applies to polygons (whether they're relations or circular ways).

rcoup commented 14 years ago

Use polygon winding option from layer in exports. closed by 72c117467cd96560c583e5698bc73c3a63adb4e8

HamishB commented 14 years ago

This all only applies to polygons (whether they're relations or circular ways).

for cliff_edge, polylines need to be reversible somehow as well.

I`m not sure if LINZ provides a layer for it or not but line direction can also have meaning for causeways.

cheers, Hamish

rcoup commented 14 years ago

Tricky to know what way things are though, would need some manual testing before setting the flag, and I doubt it would work properly for all layers...

HamishB commented 14 years ago

[cliff_edge is the only linestring this affects AFAIK; maybe we should just find/write a way reversing script for that?]

I'd suggest to have the default behaviour be to leave it in its natural order (whichever way that might be), and for the tick box flag to simply reverse that. there wouldn't be a way to know which order things were in (unless you talked to linz), you'd just have to download it and test it to find out. it would be hard to account for both linz and osm's direction-conventions without manual testing+confirmation. shrug

HamishB commented 14 years ago

hmmm. Looking at lake_poly for the Chathams, Lake Te Rangatapu (southern most big lake on Chatham Island) continues to be wrapped CCW ... ?? An old download of the data shows it to be in the same direction (CCW) as everything else which sorta indicates it isn't a mistake in LINZ's original data...??

HamishB commented 14 years ago

The JOSM Validator plugin picks these up, it turns out there were four lakes going CCW.

Upon re-reading the natural=water wiki page, I see that it says: "It doesn't matter which way around the way goes. (JOSMs validator plugin actually (still) complains about anti-clockwise ways.)" http://wiki.openstreetmap.org/wiki/Tag:natural%3Dwater#Simple_Lake

(but the coastline does care). I suppose as a favour to those who follow it would be nice to have the data all going in a consistent way, and likely some other/older OSM parsing software may well still care. It also means that this is not a blocker & so I've gone ahead and reversed the 4 by hand in the extract-download and just now uploaded the lakes_poly layer for the Chathams to the OSM server.

rcoup commented 14 years ago

ok, after my dodgy maths the ccw thing should be fixed.

There's an option in the layer screen to reverse line coordinates, so that should allow you to deal with cliff_edge :)