Mouseover coordinate conversion

1305
8
06-16-2010 09:59 AM
Gregory_L___Greg_Gunther
New Contributor II
I have a map in a non-standard projection (wkid:3338) and have implemented the "display coordinates with mouseover" functionality but want the coordinates to display as lat, long.  I noticed a conversion function for converting Web Mercator to Geographic but was hoping someone might have a solution for converting coordinates to geographic from a non-standard project coordinate system.  In case you are wondering, it is a map of the North Slope and a requirement is a standard projection for the region...
0 Kudos
8 Replies
AlessioDi_Lorenzo
New Contributor
I don't understood why you can't do the conversion as explained here.
0 Kudos
Gregory_L___Greg_Gunther
New Contributor II
I haven't looked at this and it may help.  The problem I can see is the latency it will take to project each point when it needs to really happen instantly on the client (remember it is a mouse over event on the map).  Thanks for the post.
0 Kudos
AlessioDi_Lorenzo
New Contributor
Projecting geometries of course takes time, not too much, but using onmouseover it could represent a problem...
Try the code in the example.

ciao
0 Kudos
BrettLord-Castillo
Occasional Contributor
Are mouseover coordinates a required functionality? I've found it to be an unused distraction for the most part. Might be better off having a point-click tool to query for coordinates (because people will only want lat long in certain situations anyway; and in those cases they might want actual notations on the map or a dialog box that does not change when they move the mouse and allows copy/paste).

That will require minimal server overhead while possibly still giving you exactly the functionality you need.
0 Kudos
AxelSchaefer
New Contributor II
Mouseover is only working in JavaScript on the client. Server-roundtrips are not useful for that. 😉

What you can do is to project the envelope coordinates of your map with the Geometry Service to 4326 (for example) and use that result for the interpolation on client-side script and therefore your mouse-over display. Don't know if 3338 is feasible for that.
0 Kudos
NianweiLiu
Occasional Contributor II
You would need some javascript code to implement Albers projection. You can find some math formulas from http://pubs.er.usgs.gov/djvu/PP/PP_1395.pdf  to do that. If you are not into writing code, you can use some existing lib like prj4j's JS version, but it may be quicker just implement yourself.

Most machine would not have problem in process such operation within a browser.
0 Kudos
RaviKonaparthi
New Contributor II
Hi,

The easiest way is, while adding a geometry to a map use geometry service to project into new coordinates and add the new lat and long to the graphic attributes.

Now when you mouseover you can read the attributes of the graphic and display it as it is already converted.

Let me know if you need any further help.

Regards,
Ravi.
0 Kudos
MatthewLawton
Occasional Contributor
I would like some more information on adding this second map extent that is already projected to a different coordinate system.

I am currently converting my JavaScript API applications to the Web Mercator Auxiliary Sphere projection from our native Nevada State Plane West NAD83 projection. I had a very nice (and quick) client-side conversion from Nevada State Plane to Lat/Lon that provided mouse over coordinates for our applications. I replaced this with the PROJECT function to the server and it is horribly slow and lags behind the mouse pointer by several seconds.

How do I add a second map extent for coordinate purposes only as Ravi describes?

-Matthew
0 Kudos