[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Collapse]Map Control
   [Expand]Getting Started
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Collapse]GIS Data
     Search
     Geocode
     Routing
     Elevation
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]End-User Interaction
   [Expand]Examples
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Geocode

The Map control supports Microsoft's Bing Geocode and the OpenStreetMap Geocode services, which provide information associated with the geographic point on a map (address, postcode, etc.) based on a point's location (latitude and longitude coordinates).

The Bing Geocode and OpenStreetMap Geocode data providers provide the geocoding functionality and are represented by the BingGeocodeDataProvider and OsmGeocodeDataProvider classes. The sections below explain how to use the BingGeocodeDataProvider in the map control.

Important

Due to Bing canceling the SOAP service on July 30, 2017, the Map Control's Bing Geocode provider does not work correctly in version 16.1 and earlier.

Expanded Enabling Geocode

Do the following to enable geocoding in the Map control:

The code snippet below shows how to do this.

When the Map control is connected to the Bing Geocode service, you can use the pushpin's tooltip to obtain information about a geographic point:

The image below shows how this works for "Kennedyville".

You can also use the InformationDataProviderBase.MaxVisibleResultCount property to specify how many tooltips can be shown on a map simultaneously.

Expanded Using a Custom UI

The map control allows you to obtain additional results (address, name, entity type, etc.) from the Bing Geocode service for a specified location.

Note

Set the InformationDataProviderBase.ProcessMouseEvents property to false if you do not want to generate pushpins when you click on the map.

To start geocoding for a location, call the BingGeocodeDataProvider.RequestLocationInformation or OsmGeocodeDataProvider.RequestLocationInformation method.

For instance, you have a UI that consists of 2 text boxes named "tbLatitude" and "tbLongitude", and a button named "requestLocation". To start a search, click the Request Location button. This calls the RequestLocationInformation method.

The results are stored by the RequestResultBase object's GeocodeRequestResult descendant within the LocationInformationReceived event handler arguments' LocationInformationReceivedEventArgs.Result.

The results contain the entity type, address, and coordinates associated with the geographic location.

Expanded Processing Geocode Results

To get the geocode results for a specified location, handle the BingGeocodeDataProvider.LocationInformationReceived or OsmGeocodeDataProvider.LocationInformationReceived event. The results are stored by the RequestResultBase object's GeocodeRequestResult descendant within the LocationInformationReceived event handler's LocationInformationReceivedEventArgs.

The following code snippet shows how to handle the event.

The results for Latitude - "41.27" and Longitude - "-96.05" are shown in the image below.

Expanded See Also

Is this topic helpful?​​​​​​​