[OSM-dev] Additions to Osmosis

Karl Newman siliconfiend at gmail.com
Sun Nov 11 23:45:24 GMT 2007


> I'm considering a few additions to Osmosis but I wanted to propose
> them here first before I started working on them in case anyone had
> any objections and/or guidance.
>
> 2. Add support for area filters which cross the 180th meridian
> (Opposite of prime meridian; is that the subprime meridian?) Bounding
> box is easy--just see if left > right, create 2 boxes which join at
> +/- 180 degrees, and test both for node inclusion. Polygon is
> substantially more complex--could be any number of sub-polygons which
> join at +/- 180, depending how complex and "snaky" the polygon is
> (i.e., how many times it crosses the 180th). One implicit assumption
> here is that OSM coordinates will be in unprojected decimal degrees
> (presumably WGS84). I don't know if that's a problem, but it does
> impose a restriction that wasn't (strictly) present before.

Okay, so after poking around with this a while, I've come to the
conclusion that I can't support polygons which cross the 180th/anti
meridian. For rectangles, it's easy (just look for Left > Right), but
because the polygon can take an arbitrary path, it's not strictly
possible to detect when it crosses the 180th because in theory the
polygon path could wrap around the planet the long way. I could use
some weird hacky logic such as if (fromPoint > 170 degrees && toPoint
< -170 degrees), but that just seems wrong. So, unless I get some
other suggestions, I'm going to punt on that one. I don't feel too
bad, because Google Earth doesn't support it, either (just try drawing
a polygon that crosses the 180th--it freaks out). Although, it does
support line paths which cross, however; maybe they're using a
shortest-distance comparison or something. That may be a possibility.

Fortunately, since the 180th passes through the Pacific, it shouldn't
affect very many OSM users--it slices off a bit of Siberia and bisects
a couple islands in Fiji and of course Antarctica, but if people want
to use a polygon to extract data matching those boundaries, they can
likely find a workaround.

Karl




More information about the dev mailing list