[OpenLayers-Users] getCenter + reprojection

Eric Lemoine eric.c2c at gmail.com
Thu Oct 16 12:16:13 EDT 2008


Units must be "m" with 900913. This may not be related to your
particular issue though.

Eric

2008/10/16, Volodymer Grigorenko <wolgri at googlemail.com>:
> Hi all
> i`ve have a problem with get center and in prop projection
> the situation is so function  below works fine but when browser window
> changes size it centers extend on 0lat 0lon
>
> ant suggestions
>
> var options = { controls: [],
>  projection: new OpenLayers.Projection("EPSG:900913"),
>  displayProjection: new OpenLayers.Projection("EPSG:4326"),
>  units: "dd",
>  maxResolution: 156543.0339,
>  maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
> 20037508.34, 20037508.34)
> };
> map.events.register('moveend', map, function(){prncenter();});
>
>
>
> function prncenter() {
>
>     b=map.getCenter();
>     a=b.transform( map.getProjectionObject(),map.displayProjection);
>     lat = formatDegrees(a.lat)
>     lon = formatDegrees(a.lon)
>     zproj = map.getProjectionObject();
>     kproj = map.displayProjection;
>
>     html= lat+"<br>"+lon+"<br>"+zproj+"<br>"+kproj
>     document.getElementById('center').innerHTML = html
>  };
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list