[OpenLayers-Users] Projections in Example Code

newbie120 karl-heinz-1950 at web.de
Fri Apr 9 08:11:34 EDT 2010


Hi,

I have a rather beginner question, but it puzzles me and I cannot find an
answer to it. Hope it is okay to ask.

I took some sample code from the web and the constructor of my
OpernLayers.Map object gets the following options (among others):

projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")

Later than for my OpenLayers.LonLat object there is a transform:

var lonLat = new OpenLayers.LonLat(lon, lat).transform(new
OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());

Why do I have to specify different projections? Why can't I just define I am
always using EPSG:4326 for example? (Of course assuming that my lon, lat
values are in that projection). This would save the later transformation,
wouldn't it?

I tried to set for projection and displayProjection the same value and
remove the transform. But this doesn't work. Unfortunately I only know that
my given x,y value is in geodecimal, but I have no clue and couldn't find a
web page if that is 900913 or 4326. Doesn't return the
map.getProjectionObject() the property I have set via projection: new
OpenLayers.Projection("EPSG:900913")?

Can someone shed some light onto this? Lots of questions to clear my
confusion I guess...

thanks, K.
-- 
View this message in context: http://n2.nabble.com/Projections-in-Example-Code-tp4876700p4876700.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list