[gdal-dev] Converting between datum
Andreas Theofilu
andreas at theosys.at
Sun Jun 1 07:29:07 EDT 2008
Hi to all,
I'm developing a software where I'm reading GPS coordinates out of a Garmin
device and show a track on the screen (look at
http://www.theosys/sportwatcher for the software). I use GDAL to get a map
over WMS to display it underneath the track. This works well as long as the
map uses WGS84 (or EPSG:4326), like the Garmin device does.
But I use the WMS server http://www.geoland.at/ who is able to accept
coordinates in EPSG:4326 and EPSG:31287 format. Both works, bit using
EPSG:4326 results in a map sifted a little to the left and bottom compared to
the coordinates of the Garmin device (does not happen with other WMS servers
like http://onearth.jpl.nasa.gov). Therefore I tried to convert to
EPSG:31287. With the following code snippet, I convert the coordinates of the
wanted rectangular:
oSourceSRS.SetWellKnownGeogCS ("WGS84");
oTargetSRS.importFromEPSG(31287);
poCT = OGRCreateCoordinateTransformation (&oSourceSRS, &oTargetSRS);
This works and I get a result consisting of several tiles each 256x256 pixels,
but the map parts on the tiles are rotated a little to the right, compared to
the track (the used WMS file is attached). GDAL seems to try to compensate
this and shows the tiles are shifted accordingly. This means, that some part
of the tiles is shown twice. Short: It looks ugly and wrong.
If I do no conversion, the result is not rotated and looks correct, but my
track is a little bit shifted to the right and top. But the angle is correct.
What I'm doing wrong? Is it the WMS server who gives me a wrong result or is
there something else I should do to shift my track to the right place?
Because I understand only the very most basics, I'm lost.
--
Andreas Theofilu
TheoSys - Software Systems and Solutions
http://www.theosys.at
Tel.: +43 676 / 786 53 89
-------------- next part --------------
<GDAL_WMS>
<Service name="WMS">
<Version>1.1.1</Version>
<ServerURL>http://www.geoland.at/geolandWMS/service.aspx?</serverURL>
<SRS>EPSG:31287</SRS>
<CRS>CRS:84</CRS>
<ImageFormat>image/png</ImageFormat>
<Layers>Flug_Orthofoto,Landesgrenzen,Bezirke,Gemeinden,Radwanderrouten,Autobahn,Landesstr_B,Landesstr_L,Orientierungskarte,Geonamen</Layers>
<BBoxOrder>xyXY</BBoxOrder>
</Service>
<DataWindow>
<UpperLeftX>617411.848069</UpperLeftX>
<UpperLeftY>481866.732917</UpperLeftY>
<LowerRightX>625999.900655</LowerRightX>
<LowerRightY>480111.024886</LowerRightY>
<SizeX>916</SizeX>
<SizeY>150</SizeY>
</DataWindow>
<Projection>EPSG:4326</Projection>
<BandsCount>4</BandsCount>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<OverviewCount>10</OverviewCount>
<Cache>
<Path>/home/andreas/.gdalwmscache</Path>
<Depth>2</Depth>
<Extension>.png</Extension>
</Cache>
<OfflineMode>false</OfflineMode>
<AdviseRead>false</AdviseRead>
<VerifyAdviseRead>true</VerifyAdviseRead>
</GDAL_WMS>
More information about the gdal-dev
mailing list