I have a couple or raster files in epsg:23031 reference that i want to reproject to other reference systems (epsg:4326 and google projection) using the 'on the fly reprojection' of Mapserver.
No problems using the default projection. But when i try to overlap my layer (in epsg:4326) with google earth there is a 100m misalignment between the two of them.
Any ideas?
Here is the map file:
MAP
NAME topo
IMAGECOLOR 125 125 125
SIZE 600 400
RESOLUTION 96
RESOLUTION 300
MAXSIZE 4096
STATUS ON
PROJECTION
"init=epsg:23031"
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
OUTPUTFORMAT
NAME GEOTIFF_RGB
DRIVER "GDAL/GTiff"
MIMETYPE "image/tiff"
IMAGEMODE RGB
EXTENSION "tif"
END
EXTENT 443275 4647717 488074 4691799
WEB
IMAGEPATH "C:\OSGeo4W/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wms_srs" "EPSG:4326 EPSG:900913"
END
END
LAYER
NAME orto
PROJECTION
"init=epsg:23031"
END
TYPE RASTER
DUMP TRUE
STATUS ON
TILEINDEX "orto.shp"
TILEITEM "LOCATION"
EXTENT 443275 4647717 488074 4691799
END
END
I'm using mapserver 5.6.4 that comes with osgeo4w tools
2 Answers 2
I believe that the issue that you are seeing is the result of proj4 (the projection engine behind gdal/mapserver) is not doing the datum transformation for you. This is likely because there are several options for data transforms between 23031 and WGS84 and proj.4 no longer defaults to one of them.
Take a look at this explanation: http://trac.osgeo.org/proj/wiki/GenParms#towgs84-DatumtransformationtoWGS84
If you specified a towgs parameter, you may get a more accurate transformation. If you are requesting the map from MapServer using a normal URL call, you could define your output projection using the proj4 text instead of an EPSG code, something like:
PROJECTION
proj=utm
zone=31
ellps=intl
units=m
towgs84=-87,-96,-120
no_defs
END
I came up with the towgs84 parameter based on the table here: http://earth-info.nga.mil/GandG/coordsys/onlinedatum/CountryEuropeTable.html You might be able to come up with a better one yourself.
I believe that you are requesting the image to overlay in Google Earth as a WMS, so you will need to modify the epsg database to include the towgs parameter for epsg 23031.
Your EPSG database should be at: C:/OSGeo4W/share/proj/epsg
-
Or, as Roger said, the basemap data in your area might not be all that accurate...DavidF– DavidF2010年08月17日 16:41:51 +00:00Commented Aug 17, 2010 at 16:41
-
I made the changes on the file but there's still the same misalignment. But i think that has to be something like that. I just install geoserver on a test machine with the same raster files, and there is no misalignment so i'm sure that i am doing -somewhere- something wrongNidleb– Nidleb2010年08月18日 07:31:58 +00:00Commented Aug 18, 2010 at 7:31
-
ehem... the error was tree spaces in the towgs84 line... so this is it, thank you very much!Nidleb– Nidleb2010年08月18日 07:56:43 +00:00Commented Aug 18, 2010 at 7:56
As crazy as this may sound, maybe the problem is Google Earth and not MapServer. The horizontal accuracy of some Google Earth data in my area is often poor - even by as much as 100m. Hopefully that's not the case in your area of interest, but it's something I'd look into as part of a process of elimination.
-
Hey Roger, thanks for your suggestion, i haven't think it, but unfortunately it's not the case. I just check it with an "official" web service imagery source and there's still the 100m misalignNidleb– Nidleb2010年08月18日 07:25:41 +00:00Commented Aug 18, 2010 at 7:25