Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [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]Examples
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Geocode

This document describes how to use the geocoding feature in the Map control. This feature allows you to get information about a geographic point on a map.

The document consists of the following sections.

Expanded Overview

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

The geocode functionality in the Map control is performed by the Bing Geocode data provider. This provider is represented by the BingGeocodeDataProvider object. The section below explains how to use the BingGeocodeDataProvider in the map control.

Expanded Enabling Geocode

To enable geocoding in the Map control, do the following.

The code snippet below shows how this can be done.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5061.

When the Map control is connected to the Bing Geocode service, you can obtain information about a geographic point in the pushpin's tooltip. To do this, do the following.

The image below shows how this works for the "Mecklensburgh Square" location.

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

Expanded Using a Custom UI

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

Note

If you do not want pushpins to be generated on the map by a mouse click, set the InformationDataProviderBase.ProcessMouseEvents property to false.

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 LocationInformationReceivedEventArgs of the LocationInformationReceived event handler.

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

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5061.

Expanded 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 LocationInformationReceivedEventArgs of the LocationInformationReceived event handler.

The following code snippet shows how to handle the event.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5061.

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

Expanded Examples

Expanded See Also

How would you rate this topic?​​​​​​​