2011-02-15

Examples of GML fragment in ISO 19115/19139 gmd:verticalElement

Next one is vertical.

Meteorology is really indifferent about the concept of CRS, so there is
bunch of altitude data without reference system specification. Luckily there
is EPSG:5714 registered as "msl height" so we can express it in globally
understood framework.

<gmd:verticalElement>
<gmd:EX_VerticalExtent id="boundingVerticalExtent">
<gmd:minimumValue>
<gco:Real>7.7</gco:Real>
</gmd:minimumValue>
<gmd:maximumValue>
<gco:Real>7.7</gco:Real>
</gmd:maximumValue>
<gmd:verticalCRS>
<gml:VerticalCRS gml:id="crs.msl_height">
<!-- EPSG:5714 simply means "msl height" -->
<gml:identifier codeSpace="urn:ogc:def:crs:EPSG::">5714</gml:identifier>
<!-- instruction in ISO 19136 12.2.3.4 -->
<gml:scope>not known</gml:scope>
<gml:verticalCS/>
<gml:verticalDatum />
</gml:VerticalCRS>
</gmd:verticalCRS>
</gmd:EX_VerticalExtent>
</gmd:verticalElement>

What if we use pressure coordinate or height above surface? I don't know.
Maybe WMO has to do something. It's just a creating couple of URI and code,
so it should be easy if people understands the way.

Examples of GML fragment in ISO 19115/19139 gmd:temporalElement

Sometimes ISO 19139 uses GML fragments to describe complex structure. But
it is too simply documented for novice to understand how to write it. I'm a
novice too, but unfortunately had to develop a guideline.....

One of the most often-used GML in 19139 should be temporal reference in
extent information. The simplest one should be an instance (single point on
a time axis):

<gmd:EX_TemporalExtent id="time_instance">
<gmd:extent>
<gml:TimeInstant gml:id="instant">
<gml:timePosition>1992-01-01T00:00:00Z</gml:timePosition>
</gml:TimeInstant>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>

Second most useful should be a time range:

<gmd:temporalElement>
<gmd:EX_TemporalExtent id="boundingTemporalExtent">
<gmd:extent>
<gml:TimePeriod gml:id="validTimeRange">
<gml:beginPosition>1992-01-01T00:00:00Z</gml:beginPosition>
<gml:endPosition>2007-12-31T00:00:00Z</gml:endPosition>
</gml:TimePeriod>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>

Really easy, isn't it?

The time in timePosition/beginPosition/endPosition can be one of:

- xs:date
- xs:gYearMonth
- xs:gYear
- xs:time
- xs:dateTime
- xs:anyURI
- xs:decimal

Decimal is intended for numeric time, for example GPS time in seconds. URI
is intended for indicating commonly-shared era, which I don't know how to
use.

<gml:endPosition
frame="tag:toyoda.eizi@gmail.com:2011-02-12:mytime_in_seconds">23131231231.1231</gml:endPosition>

But I believe it is more explicit to use gml:timeInterval.

<gml:TimePeriod gml:id="validTimeRange3">
<gml:beginPosition>1992-01-01T00:00:00Z</gml:beginPosition>
<gml:end/>
<gml:timeInterval unit="second">32.75232143</gml:timeInterval>
</gml:TimePeriod>

Complex calendar duration in ISO format can be shown in gml:duration.

<gml:TimePeriod gml:id="validTimeRange4">
<gml:beginPosition>1992-01-01T00:00:00Z</gml:beginPosition>
<gml:end/>
<gml:duration>P2Y2M3D</gml:duration>

</gml:TimePeriod>

The 2nd example can be verbose. I don't know benefit of this form, except
each of "begin" and "end" has id attribute.

<gmd:temporalElement>
<gmd:EX_TemporalExtent id="boundingTemporalExtent">
<gmd:extent>
<gml:TimePeriod gml:id="validTimeRange">
<gml:begin>
<gml:TimeInstant gml:id="begdate">
<gml:timePosition>1992-01-01T00:00:00Z</gml:timePosition>
</gml:TimeInstant>
</gml:begin>
<gml:end>
<gml:TimeInstant gml:id="enddate">
<gml:timePosition>2007-12-31T00:00:00Z</gml:timePosition>
</gml:TimeInstant>
</gml:end>
</gml:TimePeriod>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>

something like strcmp(3) in XSLT 1.0

I had a need to compare alphanumeric string. Unfortunately XSLT 1.0 does
not have string comparison, nor even function to extract character code from
character. So following example works only for string with letters and
numbers. All other characters are treated equally, just after "z" and "_"
of the dictionary order.

<xsl:template name="strcmpAN">
<xsl:param name="a"/>
<xsl:param name="b"/>
<xsl:variable name="ia">
<xsl:call-template name="charCodeAN">
<xsl:with-param name="s" select="$a"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="ib">
<xsl:call-template name="charCodeAN">
<xsl:with-param name="s" select="$b"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$a = $b">
<xsl:value-of select="number(0)"/>
</xsl:when>
<xsl:when test="string-length($b) = 0">
<xsl:value-of select="number(1)"/>
</xsl:when>
<xsl:when test="string-length($a) = 0">
<xsl:value-of select="number(-1)"/>
</xsl:when>
<xsl:when test="$ia &gt; $ib">
<xsl:value-of select="number(1)"/>
</xsl:when>
<xsl:when test="$ia &lt; $ib">
<xsl:value-of select="number(-1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="strcmpAN">
<xsl:with-param name="a" select="substring($a, 2)"/>
<xsl:with-param name="b" select="substring($b, 2)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="charCodeAN">
<xsl:param name="s"/>
<xsl:param name="i" select="1"/>
<xsl:variable name="CHARTABLE"
select="'
0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_'"/>
<xsl:choose>
<xsl:when test="$i &gt; string-length($CHARTABLE)">
<xsl:value-of select="string-length($CHARTABLE) + 1"/>
</xsl:when>
<xsl:when test="substring($CHARTABLE, $i, 1) = substring($s, 1, 1)">
<xsl:value-of select="$i"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="charCodeAN">
<xsl:with-param name="s" select="$s"/>
<xsl:with-param name="i" select="$i + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>