[mapserver-users] Problem with OpenStreetMap, osm2pgsql, MapServer, OpenLayers and epsg=900913

roshni.spain roshni.aruna at gmail.com
Sat May 8 06:12:52 EDT 2010


Hi all,
I am rendering OSM data (imported to PostGIS with osm2pgsql) and i need to
view the map with OpenLayers on MapServer.
The steps are the following: 
- get the osm xml file from the "Export" tab of OpenStreetMap
- Rum 900913.sql on Postgis db
- Import the file using 
"osm2pgsql.exe -c -d gis -U postgres -W -H localhost -P 5432 mapa.osm -v"

Now the geometry columns have 900913 for its SRID. 

This is my MapFile:

MAP
   ...
   PROJECTION
       "init=epsg:900913"
   END
   WEB
      ...
      METADATA
         ...
         WMS_SRS "EPSG:900913"
      END
   END
   LAYER
	CONNECTIONTYPE postgis 	
	NAME "planet_osm_line" 
	CONNECTION "user=postgres dbname=gis host=localhost password=palmarouting
port=5432" 
	DATA "way FROM planet_osm_line using unique osm_id using srid=900913" 	
	PROCESSING "CLOSE_CONNECTION=DEFER" 
	STATUS ON
	TYPE line 
	CLASS 
		COLOR 0 0 255 
		SIZE 2 
	END 
	HEADER templates/header.html
	TEMPLATE templates/header.html
	PROJECTION
           'init=epsg:900913'
	END
   END
END

On my ol.html, the code is the following:

var map, layer;

      function init(){
        map = new OpenLayers.Map( 'map',{
 					maxExtent: new OpenLayers.Bounds(378107,5193120,510896,5320243),
 					maxResolution: 'auto',
 					units: "m",
 					projection: new OpenLayers.Projection("EPSG:900913")
					} 
 				);
            
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                   
"http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/palmarouting/palma2.map",
{layers: 'planet_osm_line'} );
                    
            
			map.addLayers([layer]); 
            map.zoomToMaxExtent();
        }

And the result is always a blank image. I dont think the problem is in the
OpenLayers, because i copy-paste the url image and the result is exactly the
same. 

This is the map server log result (debug level 5).
[Sat May 08 11:43:19 2010].333000 CGI Request 1 on process 6960
[Sat May 08 11:43:19 2010].477000 msDrawMap(): Layer 0 (planet_osm_line),
0.072s
[Sat May 08 11:43:19 2010].477000 msDrawMap(): Drawing Label Cache, 0.000s
[Sat May 08 11:43:19 2010].477000 msDrawMap() total time: 0.073s
[Sat May 08 11:43:19 2010].483000 msSaveImage() total time: 0.006s
[Sat May 08 11:43:19 2010].483000 mapserv request processing time (msLoadMap
not incl.): 0.150s
[Sat May 08 11:43:19 2010].483000 msFreeMap(): freeing map at 01B27910.

I have been stuck since days with the same issue, and no clue!! As for the
projection, i think i have really tried all the possible options, and the
result is always the same. 
Thanks for the help!!
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problem-with-OpenStreetMap-osm2pgsql-MapServer-OpenLayers-and-epsg-900913-tp5022925p5022925.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list