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.

I'd like to be able to display the X/Y coordinates of the user's current mouse cursor location such as with this web map.

I'm using the .NET Web ADF, C# and ArcGIS Server.

Can anyone suggest any code samples for this?

share|improve this question
    
Which web client/API are you using? –  blah238 Oct 20 '12 at 14:34
    
i'm using .net ADF –  wetland Oct 20 '12 at 14:57
1  
(-) At least read the docs on resources.arcgis.com/content/arcgissdks/10.0/net Please help yourself. Otherwise, why should we help you? –  R.K. Oct 20 '12 at 17:37

1 Answer 1

up vote 2 down vote accepted

The Common Custom JavaScript sample in the Web ADF 10 SDK Help has an example of updating the browser status bar with the current mouse cursor coordinates. See Default.aspx for the JavaScript implementation.

In the initialize() function:

// Show map coordinates in status bar based on cursor location
map.add_mouseMove(mouseMove);

A bit further down:

// Show map coordinates in status bar associated with cursor location
function mouseMove(sender,eventArgs) {
    window.status = sender.get_id() + ': ' + 
      eventArgs.coordinate.get_x().toFixed(3) + ', ' + 
      eventArgs.coordinate.get_y().toFixed(3);
}   
share|improve this answer

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.