[OpenLayers-Users] Mapserver and Openlayers - Pink Tiles

Arnd Wippermann arnd.wippermann at web.de
Thu Apr 16 07:33:55 EDT 2009


Hi,

You have to tell OpenLayers, which layer(s) to request. Set the parameter
'layers' and you should also with OpenLayers get an image.

layer = new OpenLayers.Layer.MapServer( "Spoortunnel Delft",
                  "/geoviewerbin/mapserv.exe", {map:
"c:/osgeo4w/apps/geoviewer/maps/spoortunnel.map", layers:"Topografie"} );

Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von sendeman
Gesendet: Donnerstag, 16. April 2009 12:38
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Mapserver and Openlayers - Pink Tiles


Hi All,

Thanks again for all your replies.

I got some private replies to my questions here and even though I added
users at openlayers.org to the replies I sent to the repliers to my initial
question here, my e-mail didn't arrive at the mailinglist or on this forum.
Is it possible to send e-mails in a way that they get added to the original
thread?


On-topic again. I've changed quite some things and now the pink tiles are
gone. Instead I have white tiles. :-)

This means that mapserver is generating images, but there was nothing to
draw. Maybe the extent is wrong, but I don't know why. When I use shp2img
with the extent, the image comes out fine. This is the command I used:
shp2img -m spoortunnel.map -e 83600 446000 84600 448200 -o spoortunnel.png

The current code of the html-file, the map-file and the url of one of the
white-tile-images are given below.

Any suggestions?

Best regards, Martijn.

HTML-file
<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="javascript/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( "Spoortunnel Delft",
                  "/geoviewerbin/mapserv.exe", {map:
"c:/osgeo4w/apps/geoviewer/maps/spoortunnel.map"} );
          map.addLayer(layer);

          map.zoomToExtent(new
OpenLayers.Bounds(83600,446000,84600,448200));

    		}
      // -->
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>


Map-file
MAP
	NAME Spoortunnel_Delft
	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/Topografie_Delft.tif"
		CLASS
			NAME "Topografie"
		END
	END
	
	LAYER
		NAME Tunnel
		TYPE polygon
		STATUS on
		DATA "/OSGeo4W/apps/geoviewer/data/shp/tunnel.shp"
		CLASS
			NAME "Contour spoortunnel"
			STYLE
				COLOR 197 194 194
				OPACITY 70
				OUTLINECOLOR 0 0 0
			END
		END
	END
END


URL of white-tile-image
http://localhost/geoviewerbin/mapserv.exe?map=c%3A%2Fosgeo4w%2Fapps%2Fgeovie
wer%2Fmaps%2Fspoortunnel.map&mode=map&map_imagetype=png&mapext=82750+447046.
875+84078.125+448375&imgext=82750+447046.875+84078.125+448375&map_size=256+2
56&imgx=128&imgy=128&imgxy=256+256
--
View this message in context:
http://n2.nabble.com/Mapserver-and-Openlayers---Pink-Tiles-tp2638175p2642404
.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list