Code:
map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
// new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Attribution()
],
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:4326"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
} );
map.addLayer(new OpenLayers.Layer.OSM());
var lonLat = new OpenLayers.LonLat(lon, lat)
// .transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());
map.setCenter(lonLat, zoom);
Without ".transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());" openlayers points me to wrong place. Same
with Point, Line and so on.
Buy why? I set projection to whole map "EPSG:4326". and only
OpenLayers.Layer.OSM has different projection... but when i get
"map.getProjectionObject()" it returns "EPSG:900913".
Why map is "EPSG:900913" and not "EPSG:4326"?
This bug prevent me from usage of GeoRSS because items are written in
wrong position.
Answers:
===========
Layer.OSM is a base layer, so it determines the projection of your map.
That's why you need to transform yourself.
===========
If you use Google layers or any layers using the Google projection you
have to set projection to EPSG:900913 in the map. And you have to provide
ESPG:900913 coordinates to {{{setCenter}}} and friends.
===========
Question how to set proper (EPSG:4326) projection to whole map? or how to
set auto-trahsformation for GeoRSS?
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Stranges-with-projection-tp5637714p5637714.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users