Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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());
share|improve this question
    
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 –  user24863 Jan 13 at 19:10
add comment

1 Answer

up vote 6 down vote accepted

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

http://openlayers.org/dev/examples/mouse-position.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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