3

I added mouse control on the map with Lat/Long as display projection. I added a dropbox on the map for the user to choose a coordinate system (3 choices). Depending on the selection, I would like to change the displayed coordinates. What I'm missing is the syntax to do that.

This is my initial coordinate system:

map.addControl(new OpenLayers.Control.MousePosition({displayProjection: 'EPSG:4326'}));

If the choice is EPSG:32187, I tried to change it:

displayProjection: new OpenLayers.Projection("EPSG:32187") });

OpenLayers.Control.MousePosition({displayProjection: 'EPSG:32187'});

map.displayProjection = new OpenLayers.Projection("EPSG:32187"); 

map.MousePosition = new OpenLayers.Projection("EPSG:32187");

Nothing works.

The only thing it worked is if I add another MousePosition control:

map.addControl(new OpenLayers.Control.MousePosition({displayProjection: 'EPSG:32187'}));

But that they are on on top of the other and I would like to reuse the existing Mouse control.

1 Answer 1

1

I ended by removing the MousePosition Control and adding a new one Not the most elegant solution but works

I'm still wondering about possibility of reusing existing controls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.