WebMapViewer
From Xojo Documentation
Supported Platforms Project Types: Web Platforms: macOS, Windows, Linux |
New in 2011r2
Adds a Google map to the WE interface. It is initially centered at the position specified by Latitude, Longitude.
Properties | |||||||||||||||||||||||||||||
|
Methods | ||||||||||||||||
|
Notes
As of June 2018, Google Maps requires an API Key. You will need to set the APIKey property to your API Key in order for WebMapViewer to display any maps. |
The WebMapViewer control is based on Google maps. As such, has the same strengths and limitations of Google Maps.
At present, Google recommends the following browsers:
- Microsoft Internet Explorer (IE) 9.0 and later (for Windows)1
- Firefox 3.6 and later (for Windows, Mac, and Linux)
- Safari 3.1 and later (for Mac and Windows)
- Google Chrome (for Windows and Mac)
WebMapViewer has also been tested on iOS devices and on the Android emulator.
1As of November 2012, Google no longer supports Internet Explorer version 8 and earlier in their applications. If you want to use WebMapViewer in your projects, users will need to use another supported browser. You can detect the browser version in the WebSession.PrepareSession event like this:
// Show page displaying supported web browsers
End If
Google Maps API Key
As of June 2018, Google Maps requires an API Key. Visit the Google Maps docs for more information on usage:
Google Maps Platform User Guide
The MapViewer User Interface
When you add a WebMapViewer control to a WebPage, it comes with widgets to manipulate the zoom, the type, and the location. The zoom level is adjusted via the Slider control on the left and you can change the location by dragging with the hand (top-left). The type of map is changed by clicking the segmented control on the top-right corner. When you change the type (for example, from Map to Satellite), a check box appears below the Segmented Control to toggle that view type. If Map is selected, a Terrain checkbox appears to show or hide terrain features; if Satellite is selected, a checkbox appears to show or hide labels.
Sample Code
Create and display a location on the map:
Display a location entered by the user (in the LocationField TextField) on the map:
Var location As New WebMapLocation(LocationField.Text)
MapViewer1.GoToLocation(location)
Catch e As NilObjectException
MsgBox("Invalid location.")
End Try