[OpenLayers-Users] Cartographic coordinates with Google Maps
Andreas Hocevar
ahocevar at opengeo.org
Sat Jan 14 16:15:34 EST 2012
Hi,
this is because you are using the GMaps v2 API, where the map uses
EPSG:4326 as projection. Please see
http://openlayers.org/dev/examples/google-v3.html for the correct
script resource to include GMaps v3, or configure the layer with the
"sphericalMercator: true" option and the map with
maxExtent: new OpenLayers.Bounds(
-128 * 156543.03390625,
-128 * 156543.03390625,
128 * 156543.03390625,
128 * 156543.03390625
),
sphericalMercator: true,
maxResolution: 156543.03390625,
units: "m",
projection: "EPSG:900913"
Andreas.
2012/1/13 Luís de Sousa <luis.a.de.sousa at gmail.com>:
> Dear all,
>
> Bellow is the code of a simple map using a Google layer with the
> MousePosition control. Even though I'm passing the 900913 projection for the
> map projection and the map displayProjection properties the coordinates
> shown in the MousePosition are Geodetical (lat,lon in degrees) instead of
> Cartographic (x,y in meters). What am I missing?
>
> Thank you,
>
> Luís
>
> function initMap(){
>
> map = new OpenLayers.Map("myMap",{
> projection: new OpenLayers.Projection("EPSG:900913"),
> displayProjection: new OpenLayers.Projection("EPSG:900913"),
> units: "m"
> });
>
> map.addControl(new OpenLayers.Control.MousePosition());
> map.addControl(new OpenLayers.Control.LayerSwitcher());
>
> var gphy = new OpenLayers.Layer.Google(
> "Google Physical",
> {type: G_PHYSICAL_MAP}
> );
>
> map.addLayers([gphy]);
>
> }
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Cartographic-coordinates-with-Google-Maps-tp7184427p7184427.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list