← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2011: Knut's modification to gml transform to round to sensible number of digits.

 

------------------------------------------------------------
revno: 2011
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2010-08-30 17:10:53 +0100
message:
  Knut's modification to gml transform to round to sensible number of digits.
  
  Note: this is likely to be considerably slower than before.  If anyone has a large gml file to test it would be useful to assess the impact.
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl	2010-07-21 16:40:03 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl	2010-08-30 16:10:53 +0000
@@ -13,8 +13,10 @@
   <xsl:param name="coordinates"/>
   <xsl:variable name="newlist" select="concat(normalize-space($coordinates), ' ')"/>
   <xsl:variable name="first" select="substring-before($newlist, ' ')"/>
+  <xsl:variable name="xcoord" select="substring-before($first, ',')"/>
+  <xsl:variable name="ycoord" select="substring-after($first, ',')"/>
   <xsl:variable name="remaining" select="substring-after($newlist, ' ')"/>
-  <coord><xsl:value-of select="$first"/></coord>
+  <coord><xsl:value-of select="round(10000*$xcoord) div 10000"/>,<xsl:value-of select="round(10000*$ycoord) div 10000"/></coord>
   <xsl:if test="$remaining">
     <xsl:call-template name="coordinates-delimiter">
       <xsl:with-param name="coordinates" select="$remaining"/>
@@ -22,6 +24,7 @@
   </xsl:if>
 </xsl:template>
 
+
 <xsl:template match="gml:Polygon">
   <feature type="Polygon">
     <xsl:apply-templates select=".//gml:coordinates"/>