Hi Mulone, We're using the 2 same projection systems to build the service you might see at www.v-trafic.com
It's working but with no use of OpenLayers to perform the overlay and no PostGIS database (shapefile instead with WGS84 long/lat coordinates, epsg:4326). So if your problem comes from either OpenLayers or PostGIS, the following description won't help you anyway. The layers are requested with a WMS-formatted url with CRS=EPSG:3785 and BBOX in meters. Here is the content of epsg nad file (Proj4 lib) : # WGS 84 <4326> +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs <> # Web Spherical Mercator <3785> +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m no_defs Mapfile content : (Header "MAP" section) ... PROJECTION "init=epsg:3785" END ... (Layer section) ... PROJECTION "init=epsg:4326" END ... I'm quite sure all these basic things won't probably help you but it's worth trying. Regards Clement -----Message d'origine----- De : [email protected] [mailto:[email protected]] De la part de Mulone Envoyé : mercredi 17 mars 2010 22:40 À : [email protected] Objet : [mapserver-users] MapServer, OpenStreetMap, OpenLayers + Reprojection from Latlong to Mercator: a real nightmare (apologies for cross-posting) Hi everybody, I'm trying to render openstreetmap data on a WMS on MapServer and I posted something already about this. Now it's time to summarise everything and make some sense of this. The system used to work with epsg:4326 (LATLONG from now on) but in our project we need a GoogleMaps like projection and we chose epsg:900913/epsg:3785 (MERC from now on). This is our problem. We need the image on the right but we're getting the one on the left, a flattened map: http://img7.imageshack.us/img7/8279/imagelw.png After a lot of work and unsucceful tests I post here the outcome, hoping that it will be helpful to the community - and to us :-) These are the steps I followed from the very start: 1) download osm xml file from Cloudmade (e.g. Italy.osm.bz2) 2) Run 900913.sql on my PostGIS (optional, it shouldn't matter). 3) import that file into PostGIS with command (latlong option selected): ./osm2pgsql -U userid -W -H host -d maps -p myprefix -S default.style -c -l italy.osm.bz2 4) At this point everything seems ok. The geometry columns have latlong as SRID and the tables contain geometries. It's possible to visualise this dataset with uDig or other tools and reproject it. 5) Now we want to render this stuff on MapServer. So we add the espg configs from http://spatialreference.org/ref/epsg/3785/ to our mapserver espg file: <900913> +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs <> <3785> +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs <> 6) define this minimal mapfile with one layer: http://virtualpaste.com/82467 7) run several tests with different projections and annotate the outcome. Have a look at the report: http://docs.google.com/View?id=dftx6j46_166d6r38pcs Does anybody have any idea about how we could tackle this issue? I don't know if the problem is arising from MapServer or OpenLayers, so maybe you can help me design a better test to narrow the problem down. I presume a lot of people are doing something similar to us, so others might come across this issue. Cheers, Mulone ----- Mulone PhD student -- View this message in context: http://n2.nabble.com/MapServer-OpenStreetMap-OpenLayers-Reprojection-from-Latlong-to-Mercator-a-real-nightmare-tp4753197p4753197.html Sent from the Mapserver - User mailing list archive at Nabble.com. _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
