[mapserver-users] WMS layer is not shown in right projection

Sebastian Geithner sebastian_geithner at gmx.net
Fri Sep 19 05:12:10 PDT 2008


Hi list,
I have a problem according to the projection of my layers. I have set up the foss-gis-suite and use OpenLayers as client. I have configured MapServer as WMS-Server.

If I request a layer (using EPSG-Code 31468 [Gauss Kruger zone 4]) via OpenLayers.Layer.MapServer the response is OK but if I try this with the OpenLayers.Layer.WMS layer I don't get the map. I have tested the EPSG-Code 4326 and the map shows up (but stretched).

Why can't I use the same projection for both layers or where is the failure?


OpenLayers-Code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Prototyp</title>
	<link rel="stylesheet" href="../../lib/OpenLayers-2.6/theme/default/style.css" type="text/css" />
	<style type="text/css">
		#map {
			width: 500px;
			height: 300px;
			border: 1px solid grey;
		}
    </style>
	<script src="../../lib/OpenLayers-2.6/OpenLayers.js" type="text/javascript"></script>
</head>
	<body>
		<h1 id="title">Prototyp</h1>
		<div id="tags"></div>
		<p id="shortdesc">OpenLayers in Verbindung mit lokalem UMN MapServer</p>
		<br />
		<div id="map"></div>
		<div id="legend"><img src="http://localhost:8080/tmp/thueringenleg12207028122967.png"></div>
		<br />
		<div id="info"></div>

		<script type="text/javascript">
		OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
		var bounds = new OpenLayers.Bounds(11.4929,50.8957,11.5849,50.9502);

    		var map = new OpenLayers.Map("map",{
    			units: 'm',
    			projection: 'epsg:4326'
		});

    		var mapserv = new OpenLayers.Layer.MapServer.Untiled("Local MapServer",
			"http://localhost:8080/cgi-bin/mapserv?map=/home/jade/fgs/www/htdocs/thueringen.map",
			{layers: 'Felder', format: 'png'}
		);
		var wms = new OpenLayers.Layer.WMS.Untiled( "WMS Layer",
                	"http://localhost:8080/cgi-bin/mapserv?map=/home/jade/fgs/www/htdocs/thueringen.map",
                	{layers: 'Felder', format:'png'}
		);
    		
		map.addLayer(wms);
		map.addLayer(mapserv);
    		map.addControl(new OpenLayers.Control.MouseDefaults());
		map.addControl(new OpenLayers.Control.OverviewMap());
		map.addControl(new OpenLayers.Control.LayerSwitcher());
    		
		map.zoomToExtent(bounds);
		</script>
	</body>
</html>


Map file:

MAP
	NAME "Thueringen"
	STATUS ON
	SIZE 600 400
	EXTENT 4464371.920000 5640027.581000 4470798.744000 5646045.455000
  	IMAGECOLOR 180 180 180
  	UNITS METERS
	PROJECTION
		"init=epsg:31468"
	END
	OUTPUTFORMAT
		NAME png
		DRIVER "GD/PNG"
		MIMETYPE "image/png"
		IMAGEMODE PC256
		EXTENSION "png"
	END

#--------------------------------WEB-Section------------------------------

  	WEB
    	TEMPLATE "/home/jade/fgs/www/htdocs/thueringen.html"
    	IMAGEPATH "/home/jade/fgs/www/htdocs/tmp/"
    	IMAGEURL "/tmp/"
		METADATA
			"wms_title" "WMS Map Service"
			"wms_onlineresource" "http://localhost:8080/cgi-bin/mapserv?map=/home/jade/fgs/www/htdocs/global.map"
			"wms_srs" "EPSG:4326"
		END
  	END

#--------------------------------LAYER-Section------------------------------
	
	LAYER
   		NAME "Felder"
	   	TYPE POLYGON
	   	STATUS ON
   		DATA "50353v_f.shp"
		DUMP TRUE
		TEMPLATE "/home/jade/fgs/www/htdocs/thueringen.html"
   		PROJECTION
			"init=epsg:31468"
		END
		METADATA
			"wms_title" "Felder"
			"wms_srs" "EPSG:4326"
		END
		CLASSITEM "FBI_2008"
  	 	CLASS
  	 		NAME "groesste Flaeche"
  	 		EXPRESSION "DETHLIGL50353F15"
  	 		STYLE
   		  		OUTLINECOLOR 100 100 100
   	    			COLOR 255 150 150
    	  		END
  	 	END
		CLASS
 	  		NAME "alle anderen"
 	  		EXPRESSION /./
  	 		STYLE
  	     		OUTLINECOLOR 100 100 100 
   	    		COLOR 180 255 180
  	 		END
  	 	END
	END  
END


Thanks for your help.

sebastian
-- 
Sebastian Geithner
Anna-Siemsen-Str. 85
07745 Jena

mobil: 0176-83137338

GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196



More information about the MapServer-users mailing list