[OSM-dev] Is there any API to get data from OSM as geoJson?
Roland Olbricht
roland.olbricht at gmx.de
Sun Feb 10 12:58:23 GMT 2013
Hello Stefan,
> That's what I conclude from [1] i.e. <osm-script output="json"> ...
> </osm-script>
The format option "JSON" meets the format described here:
http://wiki.openstreetmap.org/wiki/Xappy.js
This has exactly the same semantics like OSM XML and only different syntax.
However, JSON makes some JavaScript applications a lot easier than XML, so I
followed the suggestion to add it.
What makes me hesitate about GeoJSON is essentially that there is no clear
rule whether an elements becomes a linestring or a polygon. Solving this will
require both a test for validness (e.g. self intersections, but also some
other corner cases. Most are listed on
http://wiki.openstreetmap.org/wiki/Multipolygon#Valid_Multipolygon_conditions
) as well as a semantic interpretation of tags.
The most likely mid-term solution is to convert ways always to linestrings,
but the area type to polygons. This has the advantage that both the code to
validate polygons and the choice of tags is done by code that does this anyway
for area creation.
I will code this proper together with a area output implementation conforming
to Jochen's outline
http://blog.jochentopf.com/2012-11-26-an-area-datatype-for-osm.html
so it will take some time until it gets available. I expect it is complete
some weeks before the FOSSGIS conference, together with a couple of other
larger changes.
Cheers,
Roland
More information about the dev
mailing list