Products Resources Support About Us

CorVu NG - Example Use of the 'Geolocation' Parameter

ideas

#1

Using the Geolocation parameter to map your current location:

When viewing a dashboard on the web or on a mobile device, the GEOLOCATION parameter can be used to get the current latitude/longitude of the device. The GEOLOCATION parameter stores the current latitude/longitude as a point set – eg (44.860,-93.388).

This might be useful if you had an application that mapped something like a Sales Representative’s current location and with their customer addresses.

See the following example to place a marker of your current location on a map:

  1. Add a new map object to the dashboard

  2. On the first page of the ‘Map Wizard’, you can leave the defaults (though I usually check all options under ‘map controls’ – these properties can be changed after the map is created) and click ‘Next’

  3. In the ‘Define Map Content’ pane, check ‘Create an empty map’ radio button and click ‘Finish’

  4. This should give you an empty map

  5. In the canvas, select the map to view the map object properties

  6. Change the ‘ViewpointMode’ to ‘Direct’. This will allow you to specify the ‘ViewpointLatitude’ and ‘ViewpointLongitude’. Set ‘ViewpointLatitude’ to ‘=getX(Geolocation)’ and the ‘ViewpointLongitude’ to ‘=getY(Geolocation)’. You may also want to increase the ‘ViewpointZoom’. The higher the number, the more zoomed in the map will be. You’ll want to experiment with this to find the right zoom for your application. When you are done, the properties should look like:

  7. From the Palette, select the MapMarker object. Drag this over the empty map in the Project Explorer. This should put the marker on the map (shown as being under the map in the Project Explorer):

  8. In the Project Explorer, click on the MapMarker to bring up its properties.

  9. Set the ‘Latitude’ property to ‘=getX(Geolocation)’ and set the ‘Longitude’ property to ‘=getY(Geolocation)’. The MapMarker properties should look similar to:

  10. The last step will be to add an event that triggers the ‘Refresh geolocation’ action. In this example, we’ll use the ‘LoadComplete’ scene event. However, the action could be triggered by any event (eg., a ‘click’ event on a button).
    Important: The action is not supported in CorVu Workstation Pro. Testing should be done via the browser using the web version or the mobile app.

In the ‘Project Explorer’, click on the scene that contains the map:

  1. With the scene selected, go to the ‘Events’ pane and double click on the ‘LoadComplete’ event:

  2. Click the ‘Add New Action’ icon. The Add New Action window opens:

  3. From the Device tree node, select ‘Refresh geolocation’ and click ‘Finish’

  4. Click OK to close the ‘LoadComplete’ Behavior window

  5. When you run the dashboard in the web, it should automatically place the marker on your device’s current latitude/longitude: