[OpenLayers-Users] OpenLayers and Projections
Erik Uzureau
euzuro at gmail.com
Mon Jul 17 11:09:36 CDT 2006
So, the patch for this is finally in. (
http://trac.openlayers.org/changeset/960)
What you need to do is when you declare your layer, pass it the option
{projection : "none" }
that will override the defaults and then nothing will be passed for SRS.
ex.
map = new OpenLayers.Map( $('map') );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'},
{projection: "none"}
);
map.addLayer(layer);
Let us know if this works correctly or if there is something else we need to
do to
keep things working for you!
-Erik
On 7/14/06, Erik Uzureau <euzuro at gmail.com> wrote:
>
> Scott,
>
> I asked one of my colleagues and he understands the problem a little
> better.
>
> "Here's the deal: the data he's using has no EPSG code. that means he
> can't select a SRS that will work: he has to leave the property out.
> However, with the current codebase, it's not possible to leave out the
> SRS entirely: if you set it to 'null', it gets replaced by the default
> of EPSG:4326."
>
> So this is just a question of making a small change to our codebase to
> make the addition of the SRS parameter optional. We should be taking
> care of this later today or tomorrow at the latest....
>
> You can keep an eye on the timeline, but anyways I'll send you an email
> when it gets committed. :-)
>
> -Erik
>
>
> On 7/14/06, Scott Knutti <sknutti at sanz.com> wrote:
> > Erik,
> >
> > I'm sorry to report that this technique did not work either. Can
> > OpenLayers handle a Proj WKT definition?
> >
> > Thanks,
> > Scott
> >
> > Erik Uzureau wrote:
> > > I have to run now. Will be back on tomorrow.... but try this:
> > >
> > > 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);
> > >
> > >
> > > hope it helps... :-)
> > > erik
> > >
> > > On 7/13/06, Scott Knutti <sknutti at sanz.com> wrote:
> > >> 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
> > >> >>
> > >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-viper.python-hosting.com/pipermail/users/attachments/20060717/a7668fd6/attachment-0001.html
More information about the Users
mailing list