Configuring map download
The mapping websites that are accessible from nhGPS are user configurable. nhGPS reads the mapping website configuration from the file c:\documents\nhgps\nhmapwebsites.xml, which is installed with nhGPS. Edit this file to customize the list of websites that is shown, or to add your own. Please note that the file will be overwritten when you reinstall or upgrade nhGPS. Also, the file format may change in the future.
To be able to download a map from a website, the site should offer some means of generating a map based on latitude/longitude. The coordinate should be passed in the form of a query string in an url (GET method). For example: http://www.mymapsite.com/mapdownload.cgi?lat=12.123&lon=15.123&zoom=1Map images can be downloaded directly or indirectly. Direct download means that nhGPS knows the URL of the map image itself. With indirect download, nhGPS knows the URL of a webpage containing the map image. It downloads the webpage and searches it for the file name of the map image. Then nhGPS downloads the image itself. The configuration file also contains information about the map scale, projection and the size of the map images. Configuration file syntaxThe configuration file is in XML format, with the following structure:<mapsites version="1"> <mapsite ... /> <mapsite ... /> ... </mapsites>Each website has its own <mapsite ... /> tag. For example, the above mentioned example might look like this: <mapsite name="My Map Site (1.4km)"
type="1"
urltemplate="http://www.mymapsite.com/mapdownload.cgi
This example is an indirect map download (type=1, see below). Please note the proper quotation of certain characters according to the XML standard: < is encoded as <, & becomes & etc. So the actual value of imgprefix is
<td align=center ><img src="Most XML tutorials will explain character encoding in detail. For indirect downloads, the urltemplate gives the url of the web page containing the map image. nhGPS replaces {latdeg} and {londeg} by the actual GPS coordinates. The resulting URL is downloaded. Next, the downloaded webpage is searched for the imgprefix text. If found, the characters following the imgprefix string are assumed to be the url of the map image. From there, the webpage is searched for the imgpostfix string, which terminates the image url. For example, if the downloaded web page would contain: <table><tr><td align=center ><img src="/images/map12345.gif"></td></tr></table>then the extracted image url would be /images/map12345.gif. This URL is expanded to an absolute URL (http://www.mymapsite.com/images/map12345.gif) and downloaded. The possible attributes for the <mapsite> tag are:
|