Aller au contenu principal

System.open-url location from right click location

Répondu

Commentaires

21 commentaires

  • Richard Diaz

    Here is an example that will open Google Streetview from the right-click context menu.  This will illustrate the use of obtaining the coordinates in the URL string.  Modify as needed for your URL.

    1.) In VertiGIS Studio Web, open the application to edit.
    2.) To the right of the interface is "Desktop Landscape Components".  Click on "Map" to open the map settings.
    3.) Navigate down and find the Context Menu.
    4.) Click +Add Menu Item.
    5.) A dialog window will open to the left. Select the Command "Open a URL" then click Select.
    6.) Change the Title to "Open Streetview".
    7.) Click the Clear Icon to remove the icon...or add and image if you want an icon.
    8.) Copy the URL shown below to the URL window:

    https://www.google.com/maps/@?api=1&map_action=pano&viewpoint={Location.Feature.Latitude},{Location.Feature.Longitude}&heading=-45&pitch=0&fov=80

    9.) Save the map, then test.

    Cheers...Rick

    0
  • Lucas Aubert

    What if you would like to add this as a feature action on a polygon layer? How would you go about modifying the URL for it to work? Thanks!

    0
  • Chris Dunlop

    Rick, I'm trying to do exactly what you describe.  It doesn't work for me - it looks like the Feature.Location.Latitude/Longitude values include the degree symbol and the N/W etc.  Do you know how I can have it supply just the raw coordinates?  Thanks!

    0
  • Richard Diaz

    The help text for “Open a URL” within the Right-Click context menu indicates that only Lat/Lon is supported.

    “ Specify the coordinate option to use when projecting coordinates. Only coordinate options that support latitude and longitude are valid. Configure coordinate options in the services tab.”

    Cheers…Rick

    0
  • Chris Dunlop

    Hi Rick.  I'm supplying DD lat/long coordinates, so that's not the issue.  I'll keep playing around with it.  Weird to me that the DD option isn't supplying just the raw numberic coordinates…

    0
  • Ali VanSickle

    Hi Chris, were you able to get this working? 

    The URL from above does not work for me either. I am passing in DD coordinates as well. Streetview is not opening.

    0
  • Gareth Evans

    Hm, I have not had this issue but this smells like a race condition or URL encoding issue whereby the URL is not being sent in the right format. I would check the browser devtools to see what the request being sent to Streetview looks like, you should be able to peek at the request/response and infer whether it is in the correct format or not.

    0
  • Ross McCandless

    Hi Gareth,

    We're also encountering this issue. This is the URL that gets passed from VS Web

    https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=43.9289%C2%B0%20N,79.4789%C2%B0%20W&heading=-45&pitch=0&fov=80

    If we manually swap out the lat long above for ones formatted like 

    43.9289,-79.4789

    Then the URL resolves just fine:

    https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=43.9289,-79.4789&heading=-45&pitch=0&fov=80 

     

     

     

     

     

     

    1
  • Gareth Evans

    Aha, yes that confirms my suspicion Ross McCandless - the issue is URL encoding. The URL we're generating includes latitude and longitude in a format with degree symbols (°) and cardinal directions (N, S, E, W), which is not compatible with Google Maps URL parameters. Additionally, these characters are being URL-encoded, further complicating the issue.

    I looked through our source code and from what I can tell the code we are using is simply passing the URL string to the browser, with no logic present to do this URL encoding, so it may be the browser that is URL encoding the result. I have not been able to identify a workaround (yet?) 

    0
  • Ali VanSickle

    I was able to get it working by using this URL instead: 

        {

            "name": "system.open-url",

            "arguments": {

                "url": "http://maps.google.com/maps?q=&layer=c&cbll={Location.Feature.Latitude},{Location.Feature.Longitude}"

            }

        }
     

    2
  • Gareth Evans

    Thanks for sharing, Ali! I believe that  URL properly handles URL encoding whereas the other one (the API v1) does not. 

    If it helps other users, I can throw together a quick example VSW app showing how to use this. 

    0
  • Ali VanSickle

    That's great! 

    Thanks,

    0
  • Ross McCandless

    This worked, thanks Ali! That'd be helpful Gareth. I can then share that with others in our org.

    0
  • Gareth Evans

    Hey Ross McCandless it's been a minute, apologies! I threw this into a knowledge base article here: Easily Integrating Third-Party Imagery with VertiGIS Studio Web Using system.open-url

    Let me know how you get on with it!

    1
  • Ross McCandless

    Thanks Gareth! Looks good. I'll share it with others in my org.

    1
  • Michelle Wang

    Hi Gareth,

    There was a bug filed for the map context menu: 300773 - Map context menu fails to load on touchscreen or mobile devices. I am wondering if you have any information about the status of this bug? 

    Thank You!

    0
  • Michelle Wang

    I just noticed that bug 300773 (Map context menu fails to load on touchscreen or mobile devices) has been fixed in version 5.33.

    1
  • Gareth Evans

    Hey Michelle Wang good news here, the fix for bug 300773 was released today as part of VSW 5.33 - it is mentioned in the Release Notes. VSW 5.33 was deployed to our VSW SaaS environment about an hour ago, and the on-prem installer is available as well.

    0
  • Gareth Evans

    Aha beat me to it! Glad you got it going.

    0
  • Michelle Wang

    Thank you Gareth for your quick response! I appreciate it!

    1
  • John Dickinson

    We ran into a brick wall trying to use System.open-url location to create a URL that linked to our app that displays aerial imagery at a specified location as specified by simple numeric “lat” and “lon” URL parameters like:  ?lat=32.264784&lon=-110.796726  - Note the lon parameter’s minus sign.

    System.open-url parameters were specified like this: llviewer.cfm?lat={Location.Feature.Latitude}&lon={Location.Feature.Longitude}

    This resulted in unexpected complex parameter values that don’t work for our app: lat=32.1681˚%20N&lon=110.75˚%20W        

    We didn't find anything we could do on the VertiGIS end to make it work.  Therefore, I made a new web page that accepts those complex VertiGIS parameter values, modifies them to the simple numeric values that the app expected, and redirects to the app using the simple numeric values as parameters.

    Most aren’t familiar with ColdFusion, but you might understand the page’s code I wrote to modify the given parameters and redirect to the app to make it work.

    <cfset variables.lat =       left(url.lat,len(url.lat)-3)>

    <cfset variables.lon = '-' & left(url.lon,len(url.lon)-3)>

    <cflocation url="llviewer.cfm?lat=#variables.lat#&lon=#variables.lon#">         

    You may find this approach works for you as well.

    1

Vous devez vous connecter pour laisser un commentaire.