Select to view content in your preferred language

MGRS Widget for Flex Viewer

7442
47
Jump to solution
02-15-2012 08:37 PM
MarcGraham
Deactivated User
Hi,

Has anyone got a compiled widget for the Flex Viewer that returns the current cursor location as an MGRS grid?

It would be great if it worked with multiple coordinate systems.

regards,

Marc
Tags (2)
0 Kudos
47 Replies
WillHughes1
Frequent Contributor
Thanks Anthony for the quick response and modification the Coordinate widget. Great tool.   -Will
0 Kudos
KennethLyons
Emerging Contributor
This is a great widget.  is there any chance I can get the uncompiled version to download? 

Also, with the bar all the way at the bottom of the page, it partially covers the scale bar.  Where can I adjust the position of the scale bar so that it isn't being covered by the coordinate bar?

Thanks
0 Kudos
AnthonyGiles
Honored Contributor
Kenneth,

The source code for the original MGRS widget (Web Mercator) is available for download from this link:

http://www.arcgis.com/home/item.html?id=56d4d2ed5d474eb4b8e29973d2376652

You will need the libraries from this download in your project if you want to implement the additions I have made. Attached is a zip file containing the source code for the coordinate banner and coordinate menu (right click context menu).

Repositioning the scalebar can be achieved by placing the following css attribute in the default.css file:

esri|ScaleBar
{
left: 50;
bottom: 50;
}

Hope this helps

Regards

Anthony
0 Kudos
KennethLyons
Emerging Contributor
Thanks for the download! 

One last question, is there a way to prevent the lat/long/MGRS overlays from displaying in my TOC widget?  I've tried to used the <excludelayers> line of code, but it doesn't seem like I'm telling it to exclude the right layer because they still show up.

If I can't prevent them from showing up, I'll just deal with it, but it's kind of annoying.

Thanks again for all your help
0 Kudos
AnthonyGiles
Honored Contributor
Kenneth,

I'm not sure how you would stop the layers from appearing in the TOC, it would probably have to be hard coded in the mapmanager to exclude these layers by thier ID's, as they are added after the config file has been read.

Maybe if Robert is reading this thread he maybe able to provide some assistance

regards

Anthony
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anthony,

   I have not looked into the code here... Are you (or the original developer) adding an id to the graphics layer added to the map?
0 Kudos
SarthakDatt
Frequent Contributor
For hiding GraphicsLayer(s) created by the widget from the TOC, you can try these options:

1. use <excludeLayer> - make sure the id of the layer matches that in the exclude layer tag
2. While adding graphics layer, make sure that the name has "hiddenLayer_" as part of it. e.g myGraphicsLayer.name = "hiddenLayer_MyGraphicsLayer" - this automatically hides it from the TOC.
0 Kudos
AnthonyGiles
Honored Contributor
Sarthak,

The hiddenLayer_ at the start of the layer name works great,

Thanks alot

Anthony
0 Kudos
KennethLyons
Emerging Contributor
So I'm pretty sure that I have the correct layer id's, but the layers are still showing up in the TOC widget, however they DO go away after they've been activated and then deactivated.  Here's what I have so far;

<configuration>
<labels>
  <visibilitylabel>Available Layers</visibilitylabel>
  <zoomtoextent>Zoom To Layer Extent</zoomtoextent>
  <expandall>Expand All Layers</expandall>
  <collapseall>Collapse All Layers</collapseall>
  <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible>
  <generatinglegendmsg>Generating Layers</generatinglegendmsg>
</labels>
<tocsettings>
  <expanded>false</expanded>
  <collapselegends>false</collapselegends>
</tocsettings>
<legendtimeout>60</legendtimeout>
<excludelayers>

  <excludelayer graphicslayer="MGRS Grid">5</excludelayer>
  <excludelayer graphicslayer="Geographic Grid">0</excludelayer>
 
</excludelayers>
<excludegraphiclayers>true</excludegraphiclayers>
<excludebasemaplayers>true</excludebasemaplayers>
<usenewesridescription>false</usenewesridescription>
</configuration>


Is this correct?  or am I way off? 

Thanks for the help
0 Kudos
AnthonyGiles
Honored Contributor
Kenneth,

In the source code of the Mgrs widget where the layer name is set just add hiddenLayer_ to the front of the name this worked for me.

Regards

Anthony
0 Kudos