What's been done so far?
As one would imagine, OSM( http://wiki.openstreetmap.org/wiki/OSM_XML ) has noticeable differences from KML ( https://developers.google.com/kml/documentation/kmlreference ), the schema upon which Marble is built. These differences, from an OSM perspective, mainly consist in server-generated data such as id, changeset, timestamp etc. but also in core data elements, such as the <relation> and <tag> tags.
Up until now, I've developed a way to store this server-generated data, mainly by saving it
as KML's ExtendedData. Exporting to ".osm" files is now possible as well, so that pretty much makes Marble a KML-to-OSM ( and in reverse ) translator at the moment ( it has some draw backs of course )
What was the main challenge?
What was the main challenge?
Not everything can be translated perfectly from OSM to KML and vice-versa, so while translating, I had to ensure as little data as possible is lost.
Since data parsing isn't a really picture-worthy topic, here is an example of a map's journey through Marble's editor:
Since data parsing isn't a really picture-worthy topic, here is an example of a map's journey through Marble's editor:
The OSM version of a highway: "sample highway"
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Marble 0.21.23 (0.22 development version)">
<node lat="-23.7082750358" lon="-4.4577696853" id="-1" action="modify" visible="false"/>
<node lat="-21.0946495732" lon="-11.9900406335" id="-2" action="modify" visible="false"/>
<node lat="-16.6010784801" lon="-6.7785258299" id="-3" action="modify" visible="true">
<tag k="name" v="sample placemark"/>
</node>
<way id="-75891" action="modify" visible="true">
<tag k="name" v="sample highway"/>
<tag k="highway" v="residential"/>
<nd ref="-1"/>
<nd ref="-2"/>
</way>
</osm>
The KML version of it after going through Marble's editor: The osm data( that is irrelevant from a KML perspective ) is stored within an ExtendedData block
<Placemark>
<name>sample highway</name>
<ExtendedData xmlns:osm_data="Marble/temporary/namespace">
<osm_data:OsmDataSnippet id="-75891" visible="true">
<osm_data:tags>
<osm_data:tag k="highway" v="residential"/>
</osm_data:tags>
<osm_data:nds>
<osm_data:nd count="0">
<osm_data:OsmDataSnippet id="-1" visible="false" action="modify"/>
</osm_data:nd>
<osm_data:nd count="1">
<osm_data:OsmDataSnippet id="-2" visible="false" action="modify"/>
</osm_data:nd>
</osm_data:nds>
</osm_data:OsmDataSnippet>
</ExtendedData>
<Style>
<IconStyle>
<Icon>
<href>share/marble/data/bitmaps/default_location.png</href>
</Icon>
</IconStyle>
</Style>
<LineString>
<coordinates>-4.457769,-23.708275 -11.990040,-21.094649</coordinates>
</LineString>
</Placemark>
No comments:
Post a Comment