Display Distance in Kilometres and Miles

In My House and My Nearest distances are measured in Kilometres or, if less than 1 Km, in metres. If you wish to display distances displayed in Km also in Miles then you can simply by editing the myNearest_Fields.xsl or myHouse_Fields.xsl.

Open the myNearest_Fields.xsl, which you will find in the following location: D:\Astun\iShare\n.n\WebApps\WebService\xml, in a text editor. Search for "Distance:" which you will find around line 125. If editing MyHouse_Fields you'll see it around line 157.

You need to replace:

with:


Before change
						<p class="atDistance">
							<strong>Distance: </strong>
							<xsl:choose>
								<xsl:when test="$dist > 1000">
									<xsl:value-of select="round($dist div 1000)" />
									km
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="round($dist)" />
									metres
								</xsl:otherwise>
							</xsl:choose>
						</p>
After change
						<p class="atDistance">
							<strong>Distance: </strong>
							<xsl:choose>
								<xsl:when test="$dist > 1000">
									<xsl:value-of select="round($dist div 1000)" />
									<xsl:text> km away (</xsl:text>
									<xsl:value-of select="format-number(round($dist div 1000) div 1.609344, '###,##0.00')" />
									<xsl:text> miles)</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="round($dist)" />
									metres
								</xsl:otherwise>
							</xsl:choose>
						</p>

Save the file as a custom file in the same webservice\xml folder e.g. myCustomHouse_Fields.xsl and change the XSL used by the mapsource by selecting the My House mapsource in Studio and under Paths and Watermarking change the XSL Path to xml/<custom file created> e.g. xml/myCustomHouse_Fields.xsl.

BeforeAfter