[OpenLayers-Users] OpenLayers and Projections

Scott Knutti sknutti at sanz.com
Thu Jul 13 13:00:36 CDT 2006


Sure, here's the code I have that returns the msWMSLoadGetMapParams(): 
Invalid SRS given error...

  var map = new OpenLayers.Map( $('map') );
  var layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
    "http://servername/cgi-bin/mapserv",
    {map: "path_to_mapfile", layers: "status", format: "image/png", 
transparent: "true", srs: "+proj=aea +ellps=GRS80 +datum=NAD83 
+lon_0=96w +lat_0=37.5n +lat_1=29.5n +lat_2=45.5n +units=m +a=6378137"} );
  map.addLayers(layer);

The Proj WKT is what I use in my mapfile and is also the projection the 
data is in.

Thanks,
Scott

Erik Uzureau wrote:
> Hi Scott,
>
> The default projection in OpenLayers is EPSG:4326.
> But you can overrride that by specifying a 'projection' value in the
> layer options (or the map options, if you wish)
>
> example:
>
>            var map = new OpenLayers.Map( $('map') );
>            var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                    "http://labs.metacarta.com/wms/vmap0",
>                    {layers: 'basic'}
>                    {projection: 'chicken'});
>            map.addLayer(layer);
>
>
> If this doesn't work, please write back. And please include either a
> link to live code or
> some code snippets and detailed errors. :-)
>
> -Erik
>
>
> On 7/13/06, Scott Knutti <sknutti at sanz.com> wrote:
>> Hi,
>>
>> I am wondering how OpenLayers handles projections.  I have some
>> shapefile data in an Albers Equal Area Conic projection that does not
>> show up in the EPSG database.  How do I specify that projection in
>> OpenLayers?  I have used the Proj WKT in my mapfile, but I get an
>> invalid SRS given when I try to use it with OpenLayers. How can I get my
>> data to display in the projection it is already in?
>>
>> Thanks,
>> Scott Knutti
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://mailman-viper.python-hosting.com/listinfo/users
>>


More information about the Users mailing list