Why can't I get the current location on my map to open Google Streetview window?

4329
13
Jump to solution
01-02-2015 10:05 AM
ChrisSergent
Regular Contributor III

I am trying to get the current location on my. The example that was used originally was for Web Mercator. What do I need to change to get the currentLocation variable to open Google Streetview?

Here is my code: JS Bin - Collaborative JavaScript Debugging  It displays currentLocation as undefined.

0 Kudos
1 Solution

Accepted Solutions
HeikoHeijenga
Esri Contributor

See Create a Map

Problem is now however that a browser's popup-blocker will kick in. This is because the new window is opened in an async callback.

View solution in original post

13 Replies
HeikoHeijenga
Esri Contributor

You forgot to require esri/geometry/Point

ChrisSergent
Regular Contributor III

That helped but I need to replace the line var theLatLongGeom = webMercatorUtils.webMercatorToGeographic(theLocation);  I'm not using webMercator. What should that be changed to?

Here is my updated code:JS Bin - Collaborative JavaScript Debugging

0 Kudos
HeikoHeijenga
Esri Contributor

Chrome DevTools is pretty clear:

missing.png

So, require esri/geometry/webMercatorUtils

0 Kudos
HeikoHeijenga
Esri Contributor

Ah, I see... You're not using webmercator

Then you would need to use the Geometry service to project to lat/long.

0 Kudos
ChrisSergent
Regular Contributor III

I was thinking that but I wasn't sure what to write or where to look. I checked in the API for geometry service and still wasn't sure. Any idea what should be written?

0 Kudos
HeikoHeijenga
Esri Contributor

See Create a Map

Problem is now however that a browser's popup-blocker will kick in. This is because the new window is opened in an async callback.

View solution in original post

ChrisSergent
Regular Contributor III

That worked. I just needed to tell my machine to trust the site that I am running on to stop the pop-up blocker and it's working well. Thanks!

0 Kudos
ChrisSergent
Regular Contributor III

One last question. My projection is 3435. It doesn't work when I replace 4326 for this. Will this be an issue? It seems to be accurate though.

0 Kudos
HeikoHeijenga
Esri Contributor

Not sure I follow, can you elaborate?

0 Kudos