[OpenLayers-Users] Getting up and running with OpenLayers

Richard Duivenvoorde rdmailings at duif.net
Fri Nov 9 12:13:44 EST 2007


Hi David,

the error you see is because openlayers is asking for a layer in the 
epsg:4326 (default latlon) projection.

You can do two things:
- either add EPSG:4326 to your WMS_SRS "EPSG:32616" line in the WEB part 
of your mapserver map file
if your mapserver and proj lib are ok, this will make mapserver project 
your 32616 data to 4326 and you will see latlon projected maps in OL.

But probably you want to see 32616 projected maps, you can do that by 
telling OL that the Map's projection is 32616: something like this:

map = new OpenLayers.Map('map',  {
   'projection':'EPSG:32616',
   'units':'m',
   'maxExtent':new OpenLayers.Bounds(582919,4182989,610195,4207241),
   });

hope this helps something.

grtz,
Richard Duivenvoorde

ps have also a look at
http://www.openlayers.org/dev/examples/projected-map.html




drk mattr wrote:
> I've been reading about OpenLayers on James Fee's blog and I'm really 
> interested in working with it.  I'm a long time ArcIMS developer so the 
> concepts here are close to what I'm used to using (well I'm not used to 
> using JavaScript which is my problem).
>  
> I've got a mapfile up and running.
>  
> MAP
>     NAME Installation
>     SIZE 800 500
>     IMAGECOLOR 240 240 240
>     EXTENT 582919.88200 4182989.235900 610195.822000 4207241.321900
>     UNITS METERS
>     PROJECTION
>       "init=EPSG:32616"
>     END
>     WEB
>         IMAGEPATH "/ms4w/tmp/ms_tmp/"
>         IMAGEURL "/ms_tmp/"
>         METADATA
>           WMS_TITLE "WMS Test"
>           WMS_ABSTRACT "My attempt at actually moving from ArcIMS to WMS"
>           WMS_ACCESSCONSTRAINTS "none"
>  
>          WMS_ONLINERESOURCE "http://localhost:8080/test/test.html"
>          WMS_SRS "EPSG:32616"
>        END
>     END
>  
>  LAYER
>   NAME "Installation"
>   TYPE POLYGON
>   STATUS DEFAULT
>   DATA "Installation_Area.shp"
>   
>   CLASS
>    NAME 'Installation'
>    OUTLINECOLOR 60 60 60
>    COLOR 255 255 0
>    SYMBOL 0
>   END
>  END 
> END
>  
> Which returns a simple map when I test it:  
> _http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map&mode=map_ 
> <http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map&mode=map>
>  
> Now, I've decided to try OpenLayers and this is my code which I borrowed 
> from one of the examples:
>  
> <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="OpenLayers.js"></script>
>     <script type="text/javascript">
>         function init(){
>             map = new OpenLayers.Map( 'map' );
>             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                     
> "http://localhost:8080/cgi-bin/mapserv.exe?MAP=/ms4w/apache/htdocs/test/test.map", 
> {layers: 'Installation'} );
>             map.addLayer(layer);
>         }
>     </script>
>   </head>
>   <body onload="init()">
>     <div id="map"></div>
>   </body>
> </html>
>  
> When I run it, I get a tiles which say:
>  
> msWMSLoadGetMapParams():  WMS server error. Invalid SRS given : SRS must 
> be valid for all requested layers.
>  
> Now I looked at the doc and it seems like you can set the projection 
> which I tried, but it still returned the same error.  I'm sure I'm 
> close, but I'm just a little out of my league right now with openlayers.
>  
> Any help would be greatly appreciated.
>  
> David.
>  
> 
>  
> 
> ------------------------------------------------------------------------
> Peek-a-boo FREE Tricks & Treats for You! Get 'em! 
> <http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list