User avatar
johan
GpsGate
Posts: 14224
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

MapData.xml format explained

Tue Aug 12, 2008 12:37 am

MapData.xml format explained - example 1

GpsGate Server supports custom raster maps. The map needs to be in 256*256 pixel large PNG tiles. And the scale and projection must be described in a file named "MapData.xml". Normally GpsTools Studio helps you to accomplish this, which is described in this guide:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=6757

But in some cases when the map is very large, it is easier to produce the raster tiles in some other tool. In those case you also need to create MapData.xml manually.

The tiles should have the following file names x_y.png, the upper left tile is named 0_0.png, the most upper tile in the second column is named 1_0.png, the most left tile in the second row is named 0_1.png, increasing x values goes from left to right, increasing y values goes from top to bottom.

The tiles and MapData.xml should then be placed in a separate folder on the server as described in the guide linked to above. How a map with different zoom levels is produces is also described in that guide.

Here is a sample MapData.xml file. Below is each tag explained.

Code: Select all

<?xml version="1.0" ?> 
<MapData>
    <Name>Sthlm</Name> 
    <ID>Sthlm_B547D963-42F4-42B9-88C3-DC186B39078E</ID> 
    <Bitmap>
        <TileSize>
            <Width>256</Width> 
            <Height>256</Height> 
        </TileSize>
        <TotalSize>
            <Width>5087</Width> 
            <Height>4850</Height> 
        </TotalSize>
    </Bitmap>
    <Geo>
        <Grid>
            <Name>No name</Name> 
            <Algorithm>3</Algorithm> 
            <FalseEasting>1500000.000000</FalseEasting> 
            <FalseNorthing>0.000000</FalseNorthing> 
            <OrigoLongitude>15.8082777778</OrigoLongitude> 
            <OrigoLatitude>0.0000000000</OrigoLatitude> 
            <Scale>1.0000000000000000000000</Scale> 
            <LatitudeSp1>0.0000000000</LatitudeSp1> 
            <LatitudeSp2>0.0000000000</LatitudeSp2> 
        </Grid>
        <Datum>
            <Name>No name</Name> 
            <SemiMajorAxis>6377397.155000</SemiMajorAxis> 
            <E2>0.0066743722</E2> 
            <DeltaX>414.1055246174</DeltaX> 
            <DeltaY>41.3265500042</DeltaY> 
            <DeltaZ>603.0582474221</DeltaZ> 
            <RotX>-0.8551163377</RotX> 
            <RotY>2.1413174055</RotY> 
            <RotZ>-7.0227298286</RotZ> 
            <Scale>0.0000000000000000000000</Scale> 
        </Datum>
        <BoundingBox>
            <MinE>1622495.000000</MinE> 
            <MinN>6585720.000000</MinN> 
            <MaxE>1633513.165946</MaxE> 
            <MaxN>6574507.688183</MaxN> 
        </BoundingBox>
    </Geo>
    <Projection>
        <Type>Linear</Type> 
        <OrigoE>1622495.0000000000000000000000</OrigoE> 
        <OrigoN>6585720.0000000000000000000000</OrigoN> 
        <DeDx>2.1659457333857648000000</DeDx> 
        <DeDy>0.0000000000000000540344</DeDy> 
        <DnDx>0.0000000000000000000000</DnDx> 
        <DnDy>-2.3118168694576200000000</DnDy> 
    </Projection>
</MapData>
Name - Just any name.
ID - A unique string.

Bitmap - Specifies bitmap size.
TileSize Width / Height - Must be 256
TotalSize Width / Height - Specifies the total size for the map in pixels.

Geo - Specifies the coordinate system used.

Grid / Datum - Projection paramaters. The easiest way to find those are to use GpsTools Studio on a small map, and save it as tiles, then copy those paramaters.

BoundingBox - The geographic size of the map.
MinE / MinN - This is the geographic coordinate for the upper left corner of the map. The unit can be meters or degrees depending on the geo coordinate system used.
MaxE / MaxN - This is the geographic coordinate for the lower right corner of the map.

Projection - Those are the multipliers between pixels and geo coordinates

Type - Should be "Linear". ("Polar" is also supported, but not explained here.)
OrigoE / OrigoN - This is the geographic coordinate for the upper left corner of the map.
DeDx - This is the number of meters (or degrees) per pixel when going from left to right on map.
DeDy - Set to 0. (Only used if map is rotated).
DnDx - Set to 0. (Only used if map is rotated).
DnDy - This is the number of meters (or degrees) per pixel when going from top to bottom.

Please post any questions to the forum, and we'll answer them there:
http://forum.gpsgate.com

Regards,
Johan

GpsGate Support

User avatar
johan
GpsGate
Posts: 14224
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: MapData.xml format explained

Tue Feb 24, 2009 2:18 am

Example 2 - "Google Maps like tiles"

Her is one more example with a WGS84 linear map (similar to Google Maps tiles).

How to calculate the values in each tag is explained below after the XML:

Code: Select all

<MapData>
<Name>MyMap</Name>
<ID>map_1C6DBC1E-46FE-4D9E-BBD7-000017E86C64</ID>
<MetaData>
  <MetaTag Name="name">MyMap</MetaTag>
  <MetaTag Name="description"/>
  <MetaTag Name="version">GpsTools Studio v2.3.1597</MetaTag>
  <MetaTag Name="created">12/02/2009 00:45:03</MetaTag>
  <MetaTag Name="lastchanged">12/02/2009 00:56:25</MetaTag>
</MetaData>
<Bitmap>
  <TileSize>
    <Width>256</Width>
    <Height>256</Height>
  </TileSize>
  <TotalSize>
    <Width>2560</Width>
    <Height>5120</Height>
  </TotalSize>
</Bitmap>
<Geo>
  <Datum>
    <Name>WGS84</Name>
    <SemiMajorAxis>6378137.00</SemiMajorAxis>
    <E2>0.0066943800</E2>
    <DeltaX>0</DeltaX>
    <DeltaY>0</DeltaY>
    <DeltaZ>0</DeltaZ>
    <RotX>0.0000000000</RotX>
    <RotY>0.0000000000</RotY>
    <RotZ>0.0000000000</RotZ>
    <Scale>0.0000000000000000000000</Scale>
  </Datum>
  <BoundingBox>
    <MinE>0.596720</MinE>
    <MinN>0.582587</MinN>
    <MaxE>0.626629</MaxE>
    <MaxN>0.514123</MaxN>
  </BoundingBox>
</Geo>
<Projection>
  <Type>Linear</Type>
  <OrigoE>0.596720</OrigoE>
  <OrigoN>0.582587</OrigoN>
  <DeDx>0.00001168320312500</DeDx>
  <DeDy>0</DeDy>
  <DnDx>0</DnDx>
  <DnDy>-0.00001337187500000</DnDy>
</Projection>
</MapData>
We assume this is a linear map in WGS84, where south to north is a straight line up, and west to east is a straight line from left to right.

TotalSize.Width = number of tiles from left to right * 256
TotalSize.Height = number of tiles from top to bottom * 256

BoundingBox.MinE and MinN = This is the upper left corner of the map in radians (not degrees).
BoundingBox.MaxE and MaxN = This is the lower right corner of the map in radians.

Radian = degree / 180 * PI

Projection.OrigoE and OrigoN should be the same values as MinE and MinN
Projection.DeDx should be (MaxE - MinE) / TotalSize.Width = (0.626629 - 0.596720) / 2570 = 0.00001168320312500
Projection.DnDy should be (MaxN - MinN) / TotalSize.Height = (0.514123 - 0.582587) / 5120 = -0.00001337187500000


Regards,
Johan

Franson Support

Return to “GpsGate Server - How to setup and use”