Skip to content

Commit

Permalink
Use xsltproc instead of Osmium to concatenate grid data files.
Browse files Browse the repository at this point in the history
This way there is no dependency on Osmium and the result data/all.osm is sorted
as usual with nodes, then ways, then relations.
  • Loading branch information
joto committed Mar 18, 2014
1 parent b235319 commit ff4ba35
Show file tree
Hide file tree
Showing 4 changed files with 2,236 additions and 2,204 deletions.
1 change: 1 addition & 0 deletions grid/.gitignore
@@ -1,3 +1,4 @@
data-files.xml
data-labels.sql
data-multipolygons.sql
data-multipolygons.wkt
Expand Down
9 changes: 7 additions & 2 deletions grid/Makefile
Expand Up @@ -34,8 +34,13 @@ grid.db: setup.sql $(SQL_FILES)

data: data/all.osm

data/all.osm: data/*/*/data.osm
$(OSMIUM) cat data/*/*/*.osm --overwrite --generator=testdata --output-header=xml_josm_upload=false --output=data/all.osm
data-files.xml: data/*/*/data.osm
echo '<?xml version="1.0" encoding="utf-8"?><files>' >$@
find data -name data.osm | sort | sed -e 's/^/<file name="/' -e 's/$$/"\/>/' >>$@
echo "</files>" >>$@

data/all.osm: data/*/*/data.osm data-files.xml
xsltproc --output $@ bin/concat.xsl data-files.xml

show:
bin/show-tests.sh
Expand Down
26 changes: 26 additions & 0 deletions grid/bin/concat.xsl
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
<osm version="0.6" generator="testdata" upload="false">
<xsl:apply-templates select="files/file" mode="nodes"/>
<xsl:apply-templates select="files/file" mode="ways"/>
<xsl:apply-templates select="files/file" mode="relations"/>
</osm>
</xsl:template>

<xsl:template match="files/file" mode="nodes">
<xsl:copy-of select="document(@name)/osm/node"/>
</xsl:template>

<xsl:template match="files/file" mode="ways">
<xsl:copy-of select="document(@name)/osm/way"/>
</xsl:template>

<xsl:template match="files/file" mode="relations">
<xsl:copy-of select="document(@name)/osm/relation"/>
</xsl:template>

</xsl:stylesheet>

0 comments on commit ff4ba35

Please sign in to comment.