Web Map Viewer
From Xojo Documentation
The Map Viewer uses Google Maps to display a map that is centered at a user-specified location. The location can be specified by its latitude and longitude coordinates or by a location, such as “Boston, MA”. You will typically also use the WebMapLocation class with Map Viewer.
|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.|
Commonly used properties and methods are listed below. For the complete list, refer to WebMapViewer in the Language Reference.
- The Google Maps API key.
- Allow you to specify or check the latitude and longitude of the center of the displayed map. Call Update to relocate the map after making changes to these values.
- Used to specify the type of map that is displayed: Roadmap, Satellite, Hybrid, Terrain.
- Adds a WebMapLocation to the map. This displays a "pin" at the location.
- Centers the map on the passed WebMapLocation.
- Removes a WebMapLocation "pin" from the map.
Web Map Location
Locations are created by using the WebMapLocation class.
You can use the Constructor to create a location based on a text address or by specific latitude and longitude as shown below.
Be sure to set your API key before attempting to display a map with code in its Open event:
This creates a location and displays it on a Map Viewer:
This displays a location entered by the user (in the LocationField TextField) on a Map Viewer:
Var location As New WebMapLocation(LocationField.Value)
Catch e As NilObjectException
- Examples/Sample Applications/EddiesElectronics/Web/EEWeb