Commit 2456ab69 authored by Kim Mortimer's avatar Kim Mortimer
Browse files

Add closing point to polygons

parent 45beb3c9
......@@ -657,15 +657,19 @@
<!-- also N.B. that a WGS 84 object is going to be in latitude, longitude but GeoJSON expects longitude, latitude -->
<!-- if it complains about separator we need to try an XSLT-1.0 implementation, I'm hopeful it might be 2.0 -->
<xsl:for-each select="gml:exterior/gml:LinearRing/gml:pos">
<xsl:value-of select="concat('[', substring-after(. ,' '), ', ', substring-before(., ' '), ']')" separator=","/>
<xsl:value-of select="concat('[', substring-after(. ,'\s'), ', ', substring-before(., '\s'), ']')" separator=","/>
</xsl:for-each>
<xsl:text>,</xsl:text>
<xsl:value-of select="concat('[', substring-after(gml:exterior/gml:LinearRing/gml:pos[1], '\s'), ', ', substring-before(gml:exterior/gml:LinearRing/gml:pos[1], '\s'), ']')"/>
</xsl:when>
<xsl:when test="./gml:exterior/gml:LinearRing/gml:pointProperty">
<!-- pretty much the same as the above except deeper inside -->
<!-- TODO: Figure out how to compute handedness of the polygon -->
<xsl:for-each select="gml:exterior/gml:LinearRing/gml:pointProperty/gml:Point/gml:pos">
<xsl:value-of select="concat('[', substring-after(. ,' '), ', ', substring-before(., ' '), ']')" separator=","/>
<xsl:value-of select="concat('[', substring-after(. ,'\s'), ', ', substring-before(., '\s'), ']')" separator=","/>
</xsl:for-each>
<xsl:text>,</xsl:text>
<xsl:value-of select="concat('[', substring-after(gml:exterior/gml:LinearRing/gml:pointProperty/gml:Point/gml:pos[1], '\s'), ', ', substring-before(gml:exterior/gml:LinearRing/gml:pointProperty/gml:Point/gml:pos[1], '\s'), ']')"/>
</xsl:when>
<xsl:when test="./gml:exterior/gml:LinearRing/gml:posList">
<!-- This is an unbroken list of coordinates so there is only one value to get -->
......@@ -685,8 +689,10 @@
[</xsl:text>
<!-- TODO: Figure out how to compute handedness of the polygon -->
<xsl:for-each select="gml:LinearRing/gml:pos">
<xsl:value-of select="concat('[', substring-after(. ,' '), ', ', substring-before(., ' '), ']')" separator=","/>
<xsl:value-of select="concat('[', substring-after(. ,'\s'), ', ', substring-before(., '\s'), ']')" separator=","/>
</xsl:for-each>
<xsl:text>,</xsl:text>
<xsl:value-of select="concat('[', substring-after(gml:LinearRing/gml:pos[1], '\s'), ', ', substring-before(gml:LinearRing/gml:pos[1], '\s'), ']')"/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:when test="./gml:LinearRing/gml:pointProperty">
......@@ -694,8 +700,10 @@
[</xsl:text>
<!-- TODO: Figure out how to compute handedness of the polygon -->
<xsl:for-each select="gml:LinearRing/gml:pointProperty/gml:Point/gml:pos">
<xsl:value-of select="concat('[', substring-after(. ,' '), ', ', substring-before(., ' '), ']')" separator=","/>
<xsl:value-of select="concat('[', substring-after(. ,'\s'), ', ', substring-before(., '\s'), ']')" separator=","/>
</xsl:for-each>
<xsl:text>,</xsl:text>
<xsl:value-of select="concat('[', substring-after(gml:LinearRing/gml:pointProperty/gml:Point/gml:pos[1], '\s'), ', ', substring-before(gml:LinearRing/gml:pointProperty/gml:Point/gml:pos[1], '\s'), ']')"/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:when test="./gml:LinearRing/gml:posList">
......@@ -723,7 +731,7 @@
<geom>
<xsl:text>{"type": "Point",</xsl:text>
<xsl:text>"coordinates": </xsl:text>
<xsl:value-of select="concat('[', substring-after(. ,' '), ', ', substring-before(., ' '), ']')"/>
<xsl:value-of select="concat('[', substring-after(. ,'\s'), ', ', substring-before(., '\s'), ']')"/>
<xsl:text>}</xsl:text>
</geom>
</xsl:for-each>
......@@ -841,7 +849,7 @@
<xsl:variable name="measureName"
select="replace(
normalize-space(
gmd:nameOfMeasure[0]/gco:CharacterString), ' ', '-')"/>
gmd:nameOfMeasure[0]/gco:CharacterString), '\s', '-')"/>
<xsl:for-each select="gmd:result/gmd:DQ_QuantitativeResult/gmd:value">
<xsl:if test=". != ''">
<xsl:element name="measure_{replace($measureName, '[^a-zA-Z0-9]', '')}">
......@@ -957,7 +965,7 @@
as="xs:string*"/>
<xsl:variable name="role"
select="replace(*[1]/gmd:role/*/@codeListValue, ' ', '')"
select="replace(*[1]/gmd:role/*/@codeListValue, '\s', '')"
as="xs:string?"/>
<xsl:if test="normalize-space($organisationName) != ''">
<xsl:element name="Org{$fieldSuffix}">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment