Select to view content in your preferred language

MGRS Coordinate Panel for Flex Viewer 3.1

1900
11
01-28-2013 01:18 AM
AnthonyGiles
Honored Contributor
All,

I have just uploaded a widget to the gallery that displays a coordinate panel along the bottom of the application that shows Map Coordinates, MGRS and Scale. It allows provides check boxes to turn on/off both MGRS and Graticule Grids. Also includes a Zoom to MGRS Function.

Give your map tag an attribute of bottom="25" to ensure that the panel does not obscure any of the map face.

http://www.arcgis.com/home/item.html?id=595088b5b5f94bd39d152f9176e33d6d

Regards

Anthony
0 Kudos
11 Replies
KennethLyons
Emerging Contributor
Anthony,
This widget is great!  One question though.  Is there a way to display Lat/Long.  I see in the .mxml that its defaulted to show what ever coordinate system the base map is, but I would find Lat/Long would be more useful to the people that access my viewer.  I've tried to tell it to show "mapLat" and "mapLon" but based on the error I get, those don't appear to be defined in the code anywhere.

Thanks
0 Kudos
AnthonyGiles
Honored Contributor
Kenneth,

I take it your application is in web mercator. The coordinates displayed are the stage x and y from the position of the mouse what you need to do is convert this from web mercator to lat long. If you have access to the source code try changing the following in the map_mouseMoveHandler function:

if (wkid === 102100 || wkid === 102113 || wkid === 3857)
{
var pt:Point = new Point(mapPoint.x, mapPoint.y);
m_geogToProg.projectInverse(pt);
mgrs = MoreUtils.getMGRSString(pt.y, pt.x);
Mercator.WebMercator.toGeographic(pt);
coords.text = "MGRS: " + mgrs + "   Scale: 1:" + map.scale + "\n" + "Lat: " + pt.y.toString() + "  Long: " + pt.x.toString();}


Regards

Anthony
0 Kudos
KennethLyons
Emerging Contributor
Anthony,
That definitly changed which coordinate system is displayed, but I think there is an issue with the conversion from mercator to lat/long.  See attached screen shot.

Thanks for helping out!
0 Kudos
AnthonyGiles
Honored Contributor
Kenneth,

Try commenting out the line:

m_geogToProg.projectInverse(pt);

And see what you get

Regards

Anthony
0 Kudos
KennethLyons
Emerging Contributor
That did it! 
Thanks for the quick response.
0 Kudos
MarcGraham
Deactivated User
Hi Anthony,

Great to see your widget is updated.  It works for me, only I cannot seem to get the MGRS Grid to display.  The lat/long grid works, but nothing happens when I click the MGRS grid box.

Cheers,

Marc

EDIT: Please disregard it is showing up now.  It didn't seem to want to show up when I had a dynamic basemap, but once I switched to a tiled map service it is showing up good as gold.  Looks great! Thanks.
0 Kudos
MarcGraham
Deactivated User
I have one other problem, I can't seem to get it to show geo or dms coordinates, no matter what option I choose in the config.xml it will only show web mercator.

Can you tell me if there is anything I can do to fix this?

Regards,

Marc
0 Kudos
AnthonyGiles
Honored Contributor
Marc,

Yes, sorry this is an old tag that has been left in from when I amended the original coordinate widget, it will have no effect on the widget now.

If you want to display geo instead of web Mercator and you have the ability to amend the source code follow the steps above

Sorry for the error

Regards

Anthony
0 Kudos
DanielBerry
Deactivated User
Anthony,

When using the "Go to MGRS:" function, where would I add a flash icon that shows where the exact location is at, similair to the CoordinateCopyWidget - helper.showGraphicAsCopied(this.mapPoint)?

Respectfully,
Dan
0 Kudos