Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

share|improve this answer
    
Or, as Roger said, the basemap data in your area might not be all that accurate... –  DavidF Aug 17 '10 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 wrong –  Nidleb Aug 18 '10 at 7:31
    
ehem... the error was tree spaces in the towgs84 line... so this is it, thank you very much! –  Nidleb Aug 18 '10 at 7:56
add comment

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.

share|improve this answer
    
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 misalign –  Nidleb Aug 18 '10 at 7:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.