Class

# WebMapLocation

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

A location on a `WebMapViewer</api/user_interface/web/webmapviewer>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                  | Type                                              | Read-Only | Shared |
|-------------------------------------------------------|---------------------------------------------------|-----------|--------|
| `Address<webmaplocation.address>`                     | `String</api/data_types/string>`                  |           |        |
| `Animated<webmaplocation.animated>`                   | `Boolean</api/data_types/boolean>`                |           |        |
| `APIKey<webmaplocation.apikey>`                       | `String</api/data_types/string>`                  | ✓         |        |
| `Icon<webmaplocation.icon>`                           | `WebPicture</api/graphics/webpicture>`            |           |        |
| `Latitude<webmaplocation.latitude>`                   | `Double</api/data_types/double>`                  |           |        |
| `Longitude<webmaplocation.longitude>`                 | `Double</api/data_types/double>`                  |           |        |
| `LookupProvider<webmaplocation.lookupprovider>`       | `LookupProviders<webmaplocation.lookupproviders>` |           | ✓      |
| `LookupProviderURL<webmaplocation.lookupproviderurl>` | `String</api/data_types/string>`                  |           |        |
| `Tag<webmaplocation.tag>`                             | `Variant</api/data_types/variant>`                |           |        |
| `Title<webmaplocation.title>`                         | `String</api/data_types/string>`                  |           |        |
| `Visible<webmaplocation.visible>`                     | `Boolean</api/data_types/boolean>`                |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                          | Parameters                                                                                                                                                        | Returns          | Shared |
|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|--------|
| `Constructor<webmaplocation.constructor0>`    | address As `String</api/data_types/string>`                                                                                                                       |                  |        |
| `Constructor<webmaplocation.constructor1>`    | latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, tag As `Variant</api/data_types/variant>` = `Nil</api/language/nil>` |                  |        |
| `DistanceTo<webmaplocation.distanceto>`       | location As <span class="title-ref">WebMapLocation</span>                                                                                                         |                  |        |
| `LookupAddress<webmaplocation.lookupaddress>` | address As `String</api/data_types/string>`, apiKey As `String</api/data_types/string>` = ""                                                                      | WebMapLocation() | ✓      |
| `MoveTo<webmaplocation.moveto>`               | latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`                                                                       |                  |        |
|                                               | address As `String</api/data_types/string>`                                                                                                                       |                  |        |

## Enumerations

<div id="webmaplocation.lookupproviders">

<div class="rst-class">

forsearch

</div>

</div>

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

<div id="webmaplocation.address">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Address

**Address** As `String</api/data_types/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.

<div id="webmaplocation.animated">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Animated

**Animated** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, displaying this location on a `WebMapViewer</api/user_interface/web/webmapviewer>` will be animated. The animation currently drops the location icon from the top of the screen.

<div id="webmaplocation.apikey">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.APIKey

**APIKey** As `String</api/data_types/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.

<div id="webmaplocation.icon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Icon

**Icon** As `WebPicture</api/graphics/webpicture>`

> The icon to be used as a marker when this location is displayed on a `WebMapViewer</api/user_interface/web/webmapviewer>`. It defaults to the default Google Maps marker icon.

<div id="webmaplocation.latitude">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Latitude

**Latitude** As `Double</api/data_types/double>`

> The GPS latitude of this location.

<div id="webmaplocation.longitude">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Longitude

**Longitude** As `Double</api/data_types/double>`

> The GPS Longitude of this location.

<div id="webmaplocation.lookupprovider">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.LookupProvider

**LookupProvider** As `LookupProviders<webmaplocation.lookupproviders>`

> Specifies the provider used for address lookup in the <span class="title-ref">WebMapLocation</span> 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.

<div id="webmaplocation.lookupproviderurl">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.LookupProviderURL

**LookupProviderURL** As `String</api/data_types/string>`

> Defines the URL of a custom Nominatim instance to be used for address lookups when `LookupProvider<webmaplocation.lookupprovider>` is set to `Custom`.
>
> This property is ignored unless the Custom option is selected in `LookupProvider<webmaplocation.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.

<div id="webmaplocation.tag">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Tag

**Tag** As `Variant</api/data_types/variant>`

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

<div id="webmaplocation.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Title

**Title** As `String</api/data_types/string>`

> If the location is attached to a `WebMapViewer</api/user_interface/web/webmapviewer>` and visible, this will set the text that is displayed when the user hovers their mouse over the corresponding icon.

<div id="webmaplocation.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Visible

**Visible** As `Boolean</api/data_types/boolean>`

> If the location is attached to a `WebMapViewer</api/user_interface/web/webmapviewer>`, this property sets whether the location is visible on the browser window. Default value is `True</api/language/true>`.

## Method descriptions

<div id="webmaplocation.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Constructor

**Constructor**(address As `String</api/data_types/string>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a <span class="title-ref">WebMapLocation</span> from the passed *address*. Invalid addresses will raise a `NilObjectException</api/exceptions/nilobjectexception>`.

<div id="webmaplocation.constructor1">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.Constructor

**Constructor**(latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, tag As `Variant</api/data_types/variant>` = `Nil</api/language/nil>`)

> Creates a <span class="title-ref">WebMapLocation</span> from the passed *latitude* and *longitude*. *tag* is an optional parameter for identifying locations.
>
> Show the specified location:
>
> ``` xojo
> Var location As New WebMapLocation(38.8977, -77.0366, "TheWhiteHouse")
> MapViewer1.GoToLocation(location)
> MapViewer1.Zoom = 19
> ```

<div id="webmaplocation.distanceto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.DistanceTo

**DistanceTo**(location As WebMapLocation)

> Returns the distance (in kilometers) of a straight line across the surface of the Earth between the current <span class="title-ref">WebMapLocation</span> and the one passed.

<div id="webmaplocation.lookupaddress">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.LookupAddress

**LookupAddress**(address As `String</api/data_types/string>`, apiKey As `String</api/data_types/string>` = "") As WebMapLocation()

> Returns an array of <span class="title-ref">WebMapLocation</span> objects because Google usually returns more than one.
>
> This method is `shared</api/language/shared>`.

<div id="webmaplocation.moveto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebMapLocation.MoveTo

**MoveTo**(latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/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</api/data_types/string>`)

> Moves a location to the passed *address*. If there is a corresponding marker on the WebMapViewer, it is also moved.
>
> ``` xojo
> Var location As New WebMapLocation
> location.MoveTo("Fenway Park, Boston, MA")
> MapViewer1.GoToLocation(location)
> ```

## Notes

Use <span class="title-ref">WebMapLocation</span> to get a location to display in a `WebMapViewer</api/user_interface/web/webmapviewer>`.

## Sample code

This example gets a location entered by the user in a `WebTextField</api/user_interface/web/webtextfield>`, creates a <span class="title-ref">WebMapLocation</span> and uses it to display the location on a `WebMapViewer</api/user_interface/web/webmapviewer>`:

``` xojo
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 |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `WebMapViewer</api/user_interface/web/webmapviewer>`

</div>
