5

The title says it all. I'm using GeoExt as part of OpenGeo Suite. I would like to display the current mouse coordinates.

Update: I was getting confused as to what parts of the code are GeoExt and which parts are OpenLayers.

Here's some code. mapPanel is a GeoExt object. mapPanel.map is an OpenLayers object.

var mapPanel = new GeoExt.MapPanel({ 
    // etc.
});

mapPanel.map.addControl(new OpenLayers.Control.MousePosition());
  • Have similar problem but I don quite Have similar problem but I don´t quite get the provided answer ... I´m building a OpenGeo app using suite SDK and so far I haven´t been able to find a way to add the Mouse Position to my code. The code I´m using does not have a GeoExt.MapPanel, instead I have var app = new gxp.Viewer({ portalConfig: {}, tools:[], //etc }); to be honest I have no idea where or how I add the openLayer.Control into these code so any idea woulb be much apreciated – gallysam Jan 13 '14 at 19:10
6

As GeoExt is using OpenLayers for the map interface, you could use its MousePosition contol :

http://openlayers.org/en/master/examples/mouse-position.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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