[OpenLayers-Trac] [OpenLayers] #3603: Problem with
Geometry.Point.clone and proj4js "transformed" property
OpenLayers
trac-20090302 at openlayers.org
Mon Jan 9 06:16:06 EST 2012
#3603: Problem with Geometry.Point.clone and proj4js "transformed" property
----------------------------+-----------------------------------------------
Reporter: milosh | Owner: tschaub
Type: bug | Status: new
Priority: major | Milestone: 2.12 Release
Component: Geometry.Point | Version: 2.11
Keywords: | State:
----------------------------+-----------------------------------------------
I've found a complicated side-effect between proj4js and OpenLayers
Geometry clone implementation.
Assume the following code:
{{
var p = new OpenLayers.Geometry.Point(1, 1);
var from = new OpenLayers.Projection("EPSG:900913");
var to = new OpenLayers.Projection("WGS84");
p.transform(from, to);
// proj4js will set p.transformed = true;
console.log(p.transformed == true);
// now try to clone the geometry and reproject back
p_new = p.clone();
// applyDefaults called within clone will duplicate
// the "transformed" bit
console.log(p_new.transformed == true);
// when proj4js will find the "transformed" attr
// it will do nothing
transformed_p = p_new.transform(to, from);
console.log(transformed_p == null);
}}
How to solve this issue? I propose proj4js independent fix that works for
me (attached).
--
Ticket URL: <http://trac.openlayers.org/ticket/3603>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list