[OpenLayers-Dev] Added OSM relation support

Ander Pijoan ander.pijoan at deusto.es
Thu Feb 21 03:21:03 PST 2013

Hi everyone.

I've been using OpenLayers for quite long and recently I was using its HTTP
protocol to download some OSM data from OpenStreetMap's Overpass API. I
needed to work with some polygon with inner holes and realized that (at
least in my version "Release 2.12") there was no support for OSM relations.

I know that relations can get very complex but at least I added support for
some cases:
- Relation with outer and inner ways (it will create a Polygon with the
inner holes)

- Relation with ways that each of them is a closed polygon (it will create
a Polygon for each way and a GeometryCollection containing all of them)

- Relation of ways that none of them is closed but their grouping creates
an area (like admin-boundaries for example) (it will create a
GeometryCollection with all the LineStrings, not a Polygon because it would
need to order all the LineStrings)

- Relation inside Relation (it won't draw the parent relation and it will
leave the other one untouched for the loop to draw it normally)

- Relation with ways and nodes (it will create a GeometryCollection with
the ways as Polygons if they are closed or as LineStrings if they aren't
and will leave the points separated from it, but they could also be added
to the GeometryCollection)

I don't know if something like this has already been made or if it could be

Example here:


Ander Pijoan Lamas
Research Assistant, Deustotech
Computer Science Engineer
University of Deusto

E-mail: ander.pijoan at deusto.es
Phone: +34 664471228
in: http://www.linkedin.com/profile/view?id=162888312
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20130221/fd16223f/attachment.html>

More information about the Dev mailing list