Class

WebMapLocation


Description

A location on a WebMapViewer.

Methods

Name

Parameters

Returns

Shared

Constructor

address As String

Constructor

latitude As Double, longitude As Double, tag As Variant = Nil

DistanceTo

location As WebMapLocation

LookupAddress

address As String, apiKey As String = ""

WebMapLocation()

MoveTo

latitude As Double, longitude As Double

address As String

Enumerations

WebMapLocation.LookupProviders

LookupProviders

Enum

Description

Custom

Use a user-defined Nominatim instance (requires setting LookupProviderURL).

Google

Use Google's geocoding service (requires API Key).

Nominatim

Use the default Nominatim service from OpenStreetMap (default setting).

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.

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.

This property is read-only.


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.LookupProvider

LookupProvider As LookupProviders

Specifies the provider used for address lookup in the WebMapLocation class. This property determines how geographical data (e.g., addresses or coordinates) is resolved.

Set this property before performing lookups to ensure the desired provider is used.

This property is shared.


WebMapLocation.LookupProviderURL

LookupProviderURL As String

Defines the URL of a custom Nominatim instance to be used for address lookups when LookupProvider is set to Custom.

This property is ignored unless the Custom option is selected in LookupProvider. Provide a valid URL pointing to your own Nominatim server (e.g., "https://your-nominatim-server.example.com"). Ensure the custom instance adheres to Nominatim's API standards for compatibility.


WebMapLocation.Tag

Tag As Variant

This can be used to store any value or object you wish to associate with the location.


WebMapLocation.Title

Title As String

If the location is attached to a WebMapViewer and visible, this will set the text that is displayed 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)

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 latitude and longitude. If there is a corresponding marker on the WebMapViewer, it is also moved.

MoveTo(address As String)

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

Project Types

Web

Operating Systems

All

See also

Object parent class; WebMapViewer