I'd like to see an add x y coordinate tool for feature layers in AGO web maps. X Y cords in lat long decimal degrees would be excellent.
Users using new Esri tools such as trek2there that requires lat and long fields from the attribute table as input https://blogs.esri.com/esri/arcgis/2016/12/22/introducing-trek2there/ would benefit, and AGO users wouldn't have to add x y cords in desktop only to republish a layer with x y cords.
Further to this - Expand capability to have automatic updated coordinates in a coordinate system of choice and bonus points to have a map that can do it while offline (in FieldMaps, etc).Just getting WGS84 is not useful in many cases even if it is close to GDA94/GDA2020. I understand that it is complicated but many photography apps like Theodolite can do the conversion to a large range of coordsys on mobile devices while offline so not sure what Esri's holdup on this is in a browser connected to the internet using a desktop/laptop.
Yes, totally agree with this. Our previous web GIS allowed you to manually input an easting/northing or x,y values and snapped the map to it. All it needs is a simple widget to allow this in ArcGIS Online.
To get around this shortcoming I have had to capture a set of points every 100 metres to cover our local authority area and ask users to use the search for a rounded co-ordinate value to match the point e.g. 488100,169100 It works, but only to the nearest 100m and its a waste of point data and storage space. If I had a larger authority area I wouldn't consider it.
Any updates if ESRI has added this feature yet or plan to?
I was able to figure it out but my zoom is not working, no matter what I change the lvl to 1-20 nothing ever happens, anyone have any idea as to why the lvl doesn't work?
"https://www.bing.com/maps?&style=o&lvl=20&dir=0&cp=" + text(Latitude) + "~" + text(Longitude);
I am trying to use the "Dynamically create a hyperlink with lat long values in a popup" from github and trying to use the Google Panoramic but when the code and click on the map I get a popup and it's just black, not sure what the issues is?
Also can it be changed to add Bings Birds view, if so how?
Hey Michael,
Thanks for providing this code.
For some reason I am unable to get it to work in the intended hosted feature layer but it works fine when I create a copy of said layer.
-Copied layer
-Original
You mentioned that this will not work in Collector - do you mean that it will not work in layers that are built via Collector or just that it won't be viewable in Collector?
Thanks for any information you can provide.
Hi Michael,
I used your code, works fine in webmap's popup but when I look it in Collector, doesn't.
I'm doing something wrong?
For Long1 and Lat1 I used a simple arcade expression
Geometry($feature)
Please if you can help me with this I'll appreciate it.
It would be amazing if the X/Y updated dynamically in AGOL. reason being: in my field of work, I have created a user friendly web map for my analysts to place points on. If i create fields of Lat Long for them to fill out, they can easily type one coordinate and place their point somewhere else. I would really like to see the fields dynamically populate as one places the points. As it stands, I see it as much safer to not even add a Lat Long field set, as it can very confusing if the hand entered coords are 12345N 123456W, but the point is placed on a map at 24580N 135790W
I'd not used jsbin before, thanks for the suggestion. However, I wasn't able to resolve that as it looks like there are many more references I need to include to build that code. In AGO, I'm simply doing:
Expression labeled Lat -
var myY = Geometry($feature),y;return (myY)
Expression labeled Lon -
var myX = Geometry($feature),longitude;return Text(myX);
When I click on the point in AGO, the popup gives me:
Lat: [object Object]Lon: {"x":-9253301,"y":4883077,"spatialReference":{"latestWkid":3857,"wkid":102100}}
I tried to do a return on myX.x (x value for Lon function), but I get the error "Cannot call member method on null. x "
If you can see the geometry values as a json structure, then it sounds like it's just a syntax problem. Can you post your code on jsbin or similar?
I've been trying to do this exact thing - return the Lat/Long from a point in a web map using ArcGIS JavaScript. In the code you have here and the code I've tried I keep getting an error "Execution Error:Runtime Error: Cannot call member method on null. x". I'm not sure what I need to do to fix this. I can get the geometry values as a json structure, but I cannot get to the individual data elements.
Any suggestions?
Arcade expressions can to some degree be used for this purpose. The following expression returns lat/long values, and can be used in popups and labels. Note it only works where the basemap is in WGS84 or Web Mercator Auxiliary Sphere.
<SPAN class="comment token">//Convert Lines/Polygons to Points</SPAN> <SPAN class="keyword token">var</SPAN> PointGeometry <SPAN class="operator token">=</SPAN> <SPAN class="token function">Centroid</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Geometry</SPAN><SPAN class="punctuation token">(</SPAN>$feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> ArcadeX <SPAN class="operator token">=</SPAN> PointGeometry<SPAN class="punctuation token">.</SPAN>x<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> ArcadeY <SPAN class="operator token">=</SPAN> PointGeometry<SPAN class="punctuation token">.</SPAN>y<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> ArcadeSr <SPAN class="operator token">=</SPAN> PointGeometry<SPAN class="punctuation token">.</SPAN>spatialReference<SPAN class="punctuation token">.</SPAN>wkid<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> Latitude<SPAN class="punctuation token">,</SPAN> Longitude<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="token function">AuxSphereToLatLon</SPAN><SPAN class="punctuation token">(</SPAN>x<SPAN class="punctuation token">,</SPAN> y<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="token function">Console</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Converting..."</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token"><SPAN>//Conversion based on </SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdotnetfollower.com%2Fwordpress%2F2011%2F07%2Fjavascript-how-to-convert-mercator-sphere-coordinates-to-latitude-and-longitude%2F" target="_blank">http://dotnetfollower.com/wordpress/2011/07/javascript-how-to-convert-mercator-sphere-coordinates-to-latitude-and-longitude/</A></SPAN> <SPAN class="keyword token">var</SPAN> rMajor <SPAN class="operator token">=</SPAN> <SPAN class="number token">6378137</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> shift <SPAN class="operator token">=</SPAN> PI <SPAN class="operator token">*</SPAN> rMajor<SPAN class="punctuation token">;</SPAN> Longitude <SPAN class="operator token">=</SPAN> x <SPAN class="operator token">/</SPAN> shift <SPAN class="operator token">*</SPAN> <SPAN class="number token">180.0</SPAN><SPAN class="punctuation token">;</SPAN> Latitude <SPAN class="operator token">=</SPAN> y <SPAN class="operator token">/</SPAN> shift <SPAN class="operator token">*</SPAN> <SPAN class="number token">180.0</SPAN><SPAN class="punctuation token">;</SPAN> Latitude <SPAN class="operator token">=</SPAN> <SPAN class="number token">180</SPAN> <SPAN class="operator token">/</SPAN> PI <SPAN class="operator token">*</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="number token">2</SPAN> <SPAN class="operator token">*</SPAN> <SPAN class="token function">Atan</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Exp</SPAN><SPAN class="punctuation token">(</SPAN>Latitude <SPAN class="operator token">*</SPAN> PI <SPAN class="operator token">/</SPAN> <SPAN class="number token">180.0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN> PI <SPAN class="operator token">/</SPAN> <SPAN class="number token">2.0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>ArcadeSr <SPAN class="operator token">==</SPAN> <SPAN class="number token">4326</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="token function">Console</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"4326 Spatial Reference - No Conversion Necessary"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> Latitude <SPAN class="operator token">=</SPAN> ArcadeY<SPAN class="punctuation token">;</SPAN> Longitude <SPAN class="operator token">=</SPAN> ArcadeX<SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>ArcadeSr <SPAN class="operator token">==</SPAN> <SPAN class="number token">102100</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="token function">Console</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"102100 Spatial Reference - Conversion Necessary"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">AuxSphereToLatLon</SPAN><SPAN class="punctuation token">(</SPAN>ArcadeX<SPAN class="punctuation token">,</SPAN> ArcadeY<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="token function">Console</SPAN><SPAN class="punctuation token">(</SPAN>ArcadeSr <SPAN class="operator token">+</SPAN> <SPAN class="string token">" Spatial Reference is not supported - currently works with Web Maps where the basemap is in WGS84 (4326) or Web Mercator Auxiliary Sphere 102100"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="token function">ReturnLatLong</SPAN><SPAN class="punctuation token">(</SPAN>Lat<SPAN class="punctuation token">,</SPAN> Long<SPAN class="punctuation token">,</SPAN> Decimals<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="token function">Text</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Round</SPAN><SPAN class="punctuation token">(</SPAN>Lat<SPAN class="punctuation token">,</SPAN> Decimals<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">", "</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="token function">Text</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Round</SPAN><SPAN class="punctuation token">(</SPAN>Long<SPAN class="punctuation token">,</SPAN> Decimals<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="token function">ReturnLatLong</SPAN><SPAN class="punctuation token">(</SPAN>Latitude<SPAN class="punctuation token">,</SPAN> Longitude<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">7</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
A similar expression can be used to build hyperlinks as in this example on GitHub which hyperlinks to the same location in Google Maps. A simlar expression could be used for Trek2There.
Arcade is not supported in Collector or Explorer popups just yet, but this is coming down the line and the above expression will work when this becomes supported. Survey123 can currently hyperlink to Trek2There by building up a hyperlink using the URL Scheme.
Mikie
Would you need the X/Y value to update dynamically if the point moved or would you be fine with having to run the tool again like how it is in ArcMap and Pro.
So much yes. Why is this not included?!? Esri has fallen in love with WGS84 web mercator and punishes you for using anything else on the web. So at least give us the XY (lat long) coordinates!!!
Melden Sie sich an, um zu posten, Inhalte zu folgen und mehr. Neu hier? Kostenlos registrieren.