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
   [Collapse]Getting Started
     Lesson 1 - Connect to the Images Provider
     Lesson 2 - Load a Vector Cartesian Map
     Lesson 3 - Add Analytical Data to a Geographical Map
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [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

Lesson 2 - Load a Vector Cartesian Map

This is the second tutorial in the Getting Started series for the Map control. It guides you through the process of creating a simple map application that draws vector data using Cartesian coordinates.

The DevExpress Map control supports displaying both Geographical and Cartesian maps. The Geographical maps usually show geospatial data using geographical coordinates (latitude and longitude), while Cartesian maps use X and Y coordinates to draw building plans or any other Cartesian data.

This tutorial consists of the following steps:

Expanded Step 1. Add a Map Control

  • Run Microsoft Visual Studio 2010, 2012, 2013, 2015 or 2017.

  • Create a new Windows Forms Application project and add the MapControl component to it. (See the first step in Lesson 1 to learn how to do this).

Expanded Step 2. Customize the Map Control

Do the following steps to prepare the Map control to draw a Cartesian map and customize control settings:

Expanded Step 3. Load Vector Data

To add a vector layer and bind it to data, do the following:

  • Select the Click here to add layer link on the map control surface.

  • In the invoked list, select the Vector Layer | Load from Shapefile item.

  • In the Open dialog, locate the C:\Users\Public\Documents\DevExpress Demos 17.1\Components\Data\Hotels\Hotel1.shp file and click Open.

  • Then, run the Layers Editor as shown below.

  • In the editor, set the CoordinateSystemDataAdapterBase.SourceCoordinateSystem property value to CartesianSourceCoordinateSystem.

Close the editor and run the application. It should look as follows:

Expanded Step 4. Customize a Colorizer

To configure a colorizer, run the Layers Editor as you did in the previous step.

Run the application. It should look as follows:

Expanded Step 5. Customize a Legend

To add a legend to the Map control, do the following:

  • Locate the MapControl.Legends property in the Properties window, and click the ellipsis button to invoke the Legends Editor. In the editor, select the ColorListLegend from the drop-down list and click the Add ColorListLegend button.

  • Set the MapLegendBase.Header property value to Room Type.

  • Finally, assign the customized vector layer as the ItemsLayerLegend.Layer property.

Expanded Result

Run the application to see the result.

Show Me

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

Expanded See Also

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