Providing Maps
- 2 minutes to read
This document explains how to use the default DevExpress Dashboard maps or provide custom maps.
Default Maps
DevExpress Dashboard ships with a set of default maps showing various parts of the world. The following maps are included.
- World Countries - a world map.
- Europe - a map of Europe.
- Asia - a map of Asia.
- North America - a map of North America.
- South America - a map of South America.
- Africa - a map of Africa.
- USA - a map of the USA.
- Canada - a map of Canada.
The World Countries map has a lower level of detail than maps of specific regions and may not contain all of the countries. As an alternative, you can load a custom map with required granularity.
To select the required default map, use the Default Map button in the Open group on the ribbon’s Design tab.
As an alternative, use the corresponding command in the map context menu.
To specify the default map in code, use the MapDashboardItem.Area property.
Custom Maps
DevExpress Dashboard uses a Shapefile vector format to provide custom maps. Commonly, this format includes two file types:
- .shp file - holds map shapes (points/lines/polygons);
- .dbf file - contains attributes for each shape.
To open an existing shapefile, use the Load Map or Import Map button in the Open group on the ribbon’s Design tab, or the command in the context menu (Load Map… or Import Map…).
In the invoked dialog, locate the required .shp file. Note that custom maps created in the Cartesian coordinate system are not supported.
Note
Attributes from the corresponding .dbf file located in the same directory will automatically be included in the map.
To load the existing shapefile in code, set the MapDashboardItem.Area property to ShapefileArea.Custom and use the MapDashboardItem.CustomShapefile property. There are two ways to provide a custom shapefile.
- Use the CustomShapefile.Url property to specify the path to the shapefile.
- Create the CustomShapefileData object, specify its CustomShapefileData.ShapeData property and CustomShapefileData.AttributeData property (optional), and assign this object to the CustomShapefile.Data property.
Note
If the map is opened using the Load Map button or the CustomShapefile.Url property, the dashboard XML definition will contain the path to a map shapefile. If the map is opened using the Import Map button or the CustomShapefile.Data property, the dashboard XML definition will contain the map itself.