Class
WebMapLocation
Description
A location on a WebMapViewer.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
Address As String |
|||
Latitude As Double, Longitude As Double, Tag As Variant = Nil |
|||
location As WebMapLocation |
|||
WebMapLocation |
✓ |
||
Property descriptions
WebMapLocation.Address
Address As String
The address of the current location. When this value is set, a request is sent to the Google Geocoder to verify the address and to request the latitude and longitude. The value may be changed to match the validated address.
WebMapLocation.Animated
Animated As Boolean
If True, displaying this location on a WebMapViewer will be animated. The animation currently drops the location icon from the top of the screen.
WebMapLocation.APIKey
APIKey As String
Map provider API/Developer Key.
This property is read-only.
For users that are doing large numbers of geocode requests, Google limits the number of requests per day. After the limit is reached, it fails with zero results. Use this property to enter your API key so you can reduce or eliminate this restriction.
WebMapLocation.Icon
Icon As WebPicture
The icon to be used as a marker when this location is displayed on a WebMapViewer. It defaults to the default Google Maps marker icon.
WebMapLocation.Latitude
Latitude As Double
The GPS latitude of this location.
WebMapLocation.Longitude
Longitude As Double
The GPS Longitude of this location.
WebMapLocation.Tag
Tag As Variant
WebMapLocation.Title
Title As String
If the location is attached to a WebMapViewer and visible, this will set the text that is desplayed when the user hovers their mouse over the corresponding icon.
WebMapLocation.Visible
Visible As Boolean
If the location is attached to a WebMapViewer, this property sets whether the location is visible on the browser window. Default value is True.
Method descriptions
WebMapLocation.Constructor
Constructor(Address as String)
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a WebMapLocation from the passed address. Invalid addresses will raise a NilObjectException.
WebMapLocation.Constructor
Constructor(Latitude as Double, Longitude as Double, Tag as Variant = Nil)
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a WebMapLocation from the passed latitude and longitude. Tag is an optional parameter for identifying locations.
Show the specified location:
Var location As New WebMapLocation(38.8977, -77.0366, "TheWhiteHouse")
MapViewer1.GoToLocation(location)
MapViewer1.Zoom = 19
WebMapLocation.DistanceTo
DistanceTo(location As WebMapLocation)
Returns the distance (in kilometers) of a straight line across the surface of the Earth between the current WebMapLocation and the one passed.
WebMapLocation.LookupAddress
LookupAddress(address As String, apiKey As String) As WebMapLocation
Returns an array of WebMapLocation objects because Google usually returns more than one.
This method is shared.
WebMapLocation.MoveTo
MoveTo(Latitude As Double, Longitude As Double)
Moves a location to the passed Address. If there is a corresponding marker on the WebMapViewer, it is also moved.
Var location As New WebMapLocation
location.MoveTo("Fenway Park, Boston, MA")
MapViewer1.GoToLocation(location)
Notes
Use WebMapLocation to get a location to display in a WebMapViewer.
Sample code
This example gets a location entered by the user in a WebTextField, creates a WebMapLocation and uses it to display the location on a WebMapViewer:
Var locationText As String
locationText = LocationField.Value
Var location As New WebMapLocation(locationText)
UserMapViewer.GotoLocation(location) // Center map at location
UserMapViewer.AddLocation(location) // Drop pin at location
Compatibility
Web projects on all supported operating systems.
See also
Object parent class; WebMapViewer