Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Infrastructure
iso19139.MERIDIAN
Commits
79e8591c
Commit
79e8591c
authored
Oct 02, 2019
by
Kim Mortimer
Browse files
Some issues with variable declaration
parent
7f75e78a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/plugin/iso19139.MERIDIAN/index-fields/index.xsl
View file @
79e8591c
...
...
@@ -748,29 +748,37 @@
</xsl:for-each>
<xsl:if
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon)>0 and count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Point)=0"
>
<geojson>
<xsl:variable
name=
"isMulti"
>
<xsl:choose>
<xsl:when
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon) = 1"
>
false
</xsl:when>
<xsl:otherwise>
true
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon) = 1"
>
<xsl:text>
{"type": "Polygon",
</xsl:text>
<xsl:text>
"coordinates": [
</xsl:text>
<xsl:variable
name=
"isMulti"
select=
"'false'"
/>
</xsl:when>
</xsl:when>
<xsl:otherwise>
<xsl:text>
{"type": "MultiPolygon",
</xsl:text>
<xsl:text>
"coordinates": [
<!-- curly brace opened, 1 or 2 square brackets opened -->
</xsl:text>
<xsl:variable
name=
"isMulti"
select=
"'true'"
/>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each
select=
".//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon"
>
<xsl:if
test=
"ends-with(@srsName, '84') or ends-with(@srsName, '4326') or not(@srsName)"
>
<xsl:if
test=
"
$isMulti = 'true'"
>
<xsl:if
test=
"$isMulti = 'true'"
>
<xsl:text>
[
</xsl:text>
<!-- wraps the entire polygon component in a square bracket -->
</xsl:if>
<!--if it's not in WGS 84 we can't convert to geoJson
if it's a polygon it has an exterior
initialize geoJson -->
<xsl:text>
[
</xsl:text>
<!-- square bracket wrapping exterior -->
<xsl:text>
[
</xsl:text>
<!-- square bracket wrapping exterior -->
<xsl:choose>
<!--determine what type of coordinates are being used-->
<xsl:when
test=
"./gml:exterior/gml:LinearRing/gml:pos"
>
...
...
@@ -811,28 +819,28 @@
<xsl:for-each
select=
"gml:interior"
>
<xsl:text>
[
</xsl:text>
<!-- wrapping interior -->
<xsl:choose>
<xsl:when
test=
"./gml:LinearRing/gml:pos"
>
<xsl:when
test=
"./gml:LinearRing/gml:pos"
>
<xsl:for-each
select=
"gml:LinearRing/gml:pos"
>
<xsl:value-of
select=
"concat('[', substring-before(. ,'\s'), ', ', substring-after(., '\s'), ']')"
separator=
","
/>
</xsl:for-each>
</xsl:when>
<xsl:when
test=
"./gml:LinearRing/gml:pointProperty"
>
<xsl:when
test=
"./gml:LinearRing/gml:pointProperty"
>
<xsl:for-each
select=
"gml:LinearRing/gml:pointProperty/gml:Point/gml:pos"
>
<xsl:value-of
select=
"concat('[', substring-before(. ,'\s'), ', ', substring-after(., '\s'), ']')"
separator=
","
/>
</xsl:for-each>
</xsl:when>
<xsl:when
test=
"./gml:LinearRing/gml:posList"
>
<xsl:when
test=
"./gml:LinearRing/gml:posList"
>
<xsl:variable
name=
"tokenizedPos"
as=
"xs:string*"
select=
"tokenize(gml:LinearRing/gml:posList, '\s')"
/>
<xsl:value-of
select=
"
substring(string-join(MER:ByTupleEncloseWithBracket($tokenizedPos), ' '),1,string-length(string-join(MER:ByTupleEncloseWithBracket($tokenizedPos), ' '))-1)
"
/>
</xsl:when>
<xsl:when
test=
"./gml:LinearRing/gml:coordinates"
>
<xsl:when
test=
"./gml:LinearRing/gml:coordinates"
>
<xsl:variable
name=
"tokenizedCoord"
as=
"xs:string*"
select=
"tokenize(gml:LinearRing/gml:coordinates, '\s')"
/>
<xsl:for-each
select=
"tokenizedCoord"
>
<xsl:value-of
select=
"concat('[', . , ']')"
separator=
", "
/>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
</xsl:choose>
<xsl:text>
]
</xsl:text>
<!-- closing interior -->
...
...
@@ -846,7 +854,7 @@
</xsl:if>
<xsl:if
test=
"position() != last() and $isMulti = 'true'"
>
<xsl:text>
,
</xsl:text>
<!-- adds a comma to allow the next polygon -->
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:text>
]}
</xsl:text>
<!-- ends the polygon wrapping as a whole -->
...
...
@@ -855,16 +863,24 @@
<!-- how to determine the average location of a poylgon? -->
<xsl:if
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Point)>0 and count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon)=0"
>
<geojson>
<xsl:variable
name=
"isMulti"
>
<xsl:choose>
<xsl:when
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Polygon) = 1"
>
false
</xsl:when>
<xsl:otherwise>
true
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when
test=
"count(.//gmd:EX_BoundingPolygon/gmd:polygon/gml:Point) = 1"
>
<xsl:text>
{"type": "Point",
</xsl:text>
<xsl:text>
"coordinates":
</xsl:text>
<xsl:variable
name=
"isMulti"
select=
"'false'"
/>
</xsl:when>
</xsl:when>
<xsl:otherwise>
<xsl:text>
{"type": "MultiPoint",
</xsl:text>
<xsl:text>
"coordinates": [
</xsl:text>
<!-- curly brace opened, 1 or 2 square brackets opened -->
<xsl:variable
name=
"isMulti"
select=
"'true'"
/>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each
select=
".//gmd:EX_BoundingPolygon/gmd:polygon/gml:Point"
>
...
...
@@ -1074,11 +1090,11 @@
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each
select=
"gmd:metadataMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceNote"
>
<versionInfo>
<xsl:value-of
select=
"./gco:CharacterString"
/>
</versionInfo>
</xsl:for-each>
<xsl:for-each
select=
"gmd:metadataMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceNote"
>
<versionInfo>
<xsl:value-of
select=
"./gco:CharacterString"
/>
</versionInfo>
</xsl:for-each>
<xsl:for-each
select=
"gmi:acquisitionInformation/*"
>
<xsl:for-each
select=
".//gmi:MI_Operation"
>
<operationStatus><xsl:value-of
select=
"./gmi:status/gmd:MD_ProgressCode[text()]"
/></operationStatus>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment