[OpenLayers-Users] Mapserver and Openlayers - Pink Tiles

sendeman martijnsendenspam at gmail.com
Wed Apr 15 07:13:58 EDT 2009


Hi All,

I'm new to Openlayers and Mapserver. I want to add a map generated by mapserver to my openlayers map. I have made a simple html-file in my http-root to test the openlayers/mapserver configuration (see below). The map file seems to work. I was able to generate an image with: shp2img -m mymap.map -o mymap.png (see below). When I open the example via localhost, I get a set of pink tiles and the requested map controls. I have added the location of one of the tile-images below. I also added the contents of the Mapserver map-file.

I have tried lot's of different ways to spell out the url's in:
layer = new OpenLayers.Layer.MapServer("MyMap","../../../bin/mapserv", {map: "../maps/mymap.map"} );
, including using absolute paths (c:\...etc). This didn't make any difference.

What should I do to get this working?

I hope anyone can help me out. Any help will be appreciated.

Best regards,
Martijn Senden.
p.s. On a sidenote: the opacity set on the shape in the map-file doesn't seem to be rendered. Any ideas?



HTML-file:
========<CODE>========

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
      #map {
        width: 800px;
        height: 475px;
        border: 1px solid black;
      }
    </style>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
      <!--
        var map, layer;
         	
        function init(){
          map = new OpenLayers.Map('map', {
  				projection: "EPSG:28992",
  				maxResolution: 1328.125,
  				numZoomLevels: 14,
  				maxExtent : new OpenLayers.Bounds(-23500,289000,316500,629000),
  				units : "meters",
  				controls: [
  					new OpenLayers.Control.ZoomToMaxExtent(),
  					new OpenLayers.Control.PanZoomBar({zoomWorldIcon: true}),
  					new OpenLayers.Control.LayerSwitcher({'ascending':false}),
  					new OpenLayers.Control.MousePosition(),
  					new OpenLayers.Control.MouseDefaults(),
  					new OpenLayers.Control.KeyboardDefaults()
  				]                    
			   });
          layer = new OpenLayers.Layer.MapServer( "MyMap",
                  "../../../bin/mapserv", {map: "../maps/mymap.map"} );
          map.addLayer(layer);
          map.zoomToExtent(new OpenLayers.Bounds(83600,446000,84600,448200));
        }
      // -->
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>

========</CODE>========



My server-root is:
C:\OSGeo4W\
The http-root is:
C:\OSGeo4W\apps\geoviewer\htdocs\
The map file is in:
C:\OSGeo4W\apps\geoviewer\maps\
The mapserv.exe is in:
C:\OSGeo4W\bin\



The map generated with shp2img:




The Mapserverv map-file:
========<CODE>========

MAP
	NAME MyMap
	STATUS on
	SIZE 900 600
	EXTENT 83600 446000 84600 448200
	UNITS meters
	IMAGECOLOR 255 255 255
	IMAGETYPE png
	
	WEB
		IMAGEPATH "/OSGeo4W/apps/geoviewer/htdocs/images/maps/"
		IMAGEURL "images/maps/"
		LOG "/OSGeo4W/apps/geoviewer/maps/tmp/mapserver.log"
	END
	
	LEGEND
		TRANSPARENT true
	END
	
	SCALEBAR
		TRANSPARENT true
	END
	
	LAYER
		NAME Topografie
		TYPE raster
		STATUS on
		DATA "/OSGeo4W/apps/geoviewer/data/raster/MyRaster.tif"
		CLASS
			NAME "MyRaster"
		END
	END
	
	LAYER
		NAME Tunnel
		TYPE polygon
		STATUS on
		DATA "/OSGeo4W/apps/geoviewer/data/shp/MyShape.shp"
		CLASS
			NAME "MyShape"
			STYLE
				COLOR 197 194 194
				OPACITY 70
				OUTLINECOLOR 0 0 0
			END
		END
	END
END

========</CODE>========



Finally: the location of one the pink image files generated by OpenLayers:

http://localhost/bin/mapserv?map=..%2Fmaps%2Fmymap.map&mode=map&map_imagetype=png&mapext=82750+447046.875+84078.125+448375&imgext=82750+447046.875+84078.125+448375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
-- 
View this message in context: http://n2.nabble.com/Mapserver-and-Openlayers---Pink-Tiles-tp2638175p2638175.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list