Select to view content in your preferred language

Streetview URL Arcade script for Field Maps

2193
9
Jump to solution
08-11-2023 11:03 AM
LindseyGreidanus
Occasional Contributor

We are using an arcade script to generate a Google Streetview link currently on web maps (From the code posted here -> https://community.esri.com/t5/arcgis-online-questions/create-url-link-to-google-street-view-for-arcg...) and I am trying to adapt it to work on field maps. 

Currently, the code works when I open the map on map viewer on desktop, but when I try it out from the Field Maps app, the coordinates part of the link is empty. 

Has anyone come across this issue or is there some reason the code would fail in a mobile app vs. the desktop setting?

Thanks

0 Kudos
1 Solution

Accepted Solutions
MarkBockenhauer
Esri Regular Contributor

I gave it a try...  the Mapviewer is returning a different wkid than Field Maps.

MarkBockenhauer_0-1692030925398.png

 

Field Maps returns

{"x":-17406622.0088,"y":2383466.8805,"spatialReference":{"wkid":3857}}

 

This inconsistency can be worked around by adding another IF accounting for 3857 line 8

if (ArcadeSr == 4326) {
  Console("4326 Spatial Reference - No Conversion Necessary");
  Latitude = ArcadeY;
  Longitude = ArcadeX;
} else if (ArcadeSr == 102100) {
  Console("102100 Spatial Reference - Conversion Necessary");
  AuxSphereToLatLon(ArcadeX, ArcadeY);
} else if (ArcadeSr == 3857) {
  Console("102100 Spatial Reference - Conversion Necessary");
  AuxSphereToLatLon(ArcadeX, ArcadeY);
} else {
  Console(ArcadeSr + " Spatial Reference is not supported - currently works with Web Maps where the basemap is in WGS84 (4326) or Web Mercator Auxiliary Sphere 102100");
}

  

View solution in original post

9 Replies
MarkBockenhauer
Esri Regular Contributor

I gave it a try...  the Mapviewer is returning a different wkid than Field Maps.

MarkBockenhauer_0-1692030925398.png

 

Field Maps returns

{"x":-17406622.0088,"y":2383466.8805,"spatialReference":{"wkid":3857}}

 

This inconsistency can be worked around by adding another IF accounting for 3857 line 8

if (ArcadeSr == 4326) {
  Console("4326 Spatial Reference - No Conversion Necessary");
  Latitude = ArcadeY;
  Longitude = ArcadeX;
} else if (ArcadeSr == 102100) {
  Console("102100 Spatial Reference - Conversion Necessary");
  AuxSphereToLatLon(ArcadeX, ArcadeY);
} else if (ArcadeSr == 3857) {
  Console("102100 Spatial Reference - Conversion Necessary");
  AuxSphereToLatLon(ArcadeX, ArcadeY);
} else {
  Console(ArcadeSr + " Spatial Reference is not supported - currently works with Web Maps where the basemap is in WGS84 (4326) or Web Mercator Auxiliary Sphere 102100");
}

  

LindseyGreidanus
Occasional Contributor

That worked, thanks for your help!

Ramon_de_Leon
Frequent Contributor

Just noticed that the StreetView links that I was able to use and worked before on pop-ups does not work anymore and just produce a black screen nowadays.... Google probably changed the correct format for StreetView links? This seems to ne an issue on desktop browsers and not on iOS devices at least when I tested it.

Ramon_de_Leon_0-1729777284053.png

 

LindseyGreidanus
Occasional Contributor

I have noticed that issue to. I do think it is on Googles side as well, but I have found that clicking the url and refreshing on the black screen makes the street view image appear again.

Ramon_de_Leon
Frequent Contributor

@LindseyGreidanus , thank you for the tip on refreshing the browser, that worked and a useful workaround until it gets a fix.

0 Kudos
Ramon_de_Leon
Frequent Contributor

Interestingly, this seems to be an issue only for Google Chrome.... if you use the same url in Edge or Firefox, you don't get the black screen and need to refresh....

0 Kudos
LindseyGreidanus
Occasional Contributor

I am using firefox and get the black screen, and others in my office are using chrome. I have not tried with edge yet. 

Edit: I tried out edge and it looks like it works without the black screen for me 🤔

0 Kudos
Ramon_de_Leon
Frequent Contributor

I have an older version of Firefox Version 112.0, that may be the difference maker...

Ramon_de_Leon
Frequent Contributor

Got this from @anonymous55  looks like this format for the link works much better from the previous one that I used.

 

var url_google = "https://www.google.com/maps/@?api=1&map_action=pano&viewpoint="
var lat = $feature.Latitude
var long = $feature.Longitude
var parm = "&heading=-45&pitch=0&fov=80" 
return Concatenate(url_google + lat +","+ long + parm)

##text: "https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=40.708136,-73.872588&heading=-45&pitch=0&fov=80"
 

 

 

Edit: I have misspoken, it is working weird again. Work for a few times then I back to having the similar issue.

 

 

 

0 Kudos