On 2011.05.07. 16:48, [email protected] wrote:
On May 7, 2011, at 9:25 AM, ext Janis Elmeris wrote:

Hello!

I am using an OpenLayers map with OpenStreetMap and Google map base layers. 
Currently I've get it working by setting map's projection to EPSG:900913, map's 
display projection to EPSG:4326, setting an option sphericalMercator=true for 
Google maps layer's and transforming OpenLayer.LonLat and 
OpenLayer.Geometry.Point from EPSG:4326 to EPSG:900913 every time I add one to 
the map. I've picked this up from various examples, so I'm not sure if this is 
the right approach in my situation. Is it?

If it is the right approach, I have several questions.

1) Why should I set sphericalMercator=true for Google maps, but not for 
OpenStreetMap? Can the Google maps layers be also used with the option being 
false, and can OSM be used with the option true?
Google Layers can be used without that setting, in which case
their coordinates are in geographic coordinates. However, this does not work 
with
many features, like overlaying WMS layers and vector coordinates.

This option does not exist on the OSM layer.

OK, so if OpenStreetMaps can be only sphericalMercator, this actually settles it (must use the option for Google), as I need OSM. (Not sure what WMS is meant for anyway, in the examples I've seen it looks like a fairly low resolution (rather an overview) of the world only.)

2) What's the point of setting the map's projection to EPSG:900913 and map's 
display projection to EPSG:4326, if I still have to transform the coordinates 
every time my script interacts with the map (adding objects on specific 
coordinates)?
The displayProjection is designed to control the output of various
controls. At some point, automatic reprojection of points and vectors
may be built into OpenLayers, but because of the way the code works,
this is a complex change, which would likely result in an API
change, and has not yet been implemented.

Thanks for the information! Is map's "projection" also used basically by the controls?

3) Do I need the transformation at all, if I use only maps with the Spherical 
Mercator projection (Google maps and OSM are all supposed to be using Spherical 
Mercator)? Shouldn't everything already be in that projection?
You don't need any transformation if all coordinates are in projected
meters, rather than in geographic coordinates. This is not usually
the situation.

Best Regards,
Christopher Schmid

Thanks for the reply!
Janis

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to