I would like to delete the last 10 letters of a URL to use in ArcGIS online to show photos in the popup. Any suggestions? I have seen people put JavaScript in the image configuration settings to get the photos to show in Show attached images inside popup with ArcGIS Online?. Maybe deleting part of a URL is possible too.
Asked
Active
Viewed 544 times
0
1 Answers
1
You can use Arcade expressions to do this. In ArcGIS Online, select the layer > Configure Popup and below the Pop-up Content area add a new Attribute Expression.
var orig = "http://www.dot.ca.gov/hq/env/gis/stormwater/sdsi/d7/photos/dp/110_s_22_12966_dis_34_0358_118_2749/index.html"
var origSplit = Split(orig, "index.html",1)
var id = $feature.objectid
var new = Concatenate([origSplit[0],id,".jpg"])
return new
Select Test and look at the returned result. Select OK and then in the Pop-Up Content, you have the option to show the results of the query in the popup window. This solution means that you are doing all the calculations dynamically which is nice because then you don't have to edit data from the original layer.
user21681
- 51
- 4
if I remove the last 10 characters so it reads: http://www.dot.ca.gov/hq/env/gis/stormwater/sdsi/d7/photos/dp/110_s_22_12966_dis_34_0358_118_2749/.
Then I can add 1.jpg so its reads: http://www.dot.ca.gov/hq/env/gis/stormwater/sdsi/d7/photos/dp/110_s_22_12966_dis_34_0358_118_2749/1.jpg
I wanted to do this using a script within the configure pop/add photo section of arcgis online
– brandon p Dec 27 '17 at 23:16dp/110_s_22_12966_dis_34_0358_118_2749/1.jpg, and if the clicked on feature with ID 2 it would bedp/110_s_22_12966_dis_34_0358_118_2749/2.jpgand so on? – GavinR Dec 30 '17 at 15:20