Load Vector Data from a Shapefile
- 2 minutes to read
This document describes the basics of working with Shapefiles using the Map Control.
This subject consists of the following sections.
A Shapefile (Esri Shapefile) is a vector format that represents geographic data (e.g., rivers, lakes, and countries) using geometries (e.g., points, polylines, and polygons). Data in this format is usually stored in two files:
- a .shp file that contains data about geometries;
- a .dbf file that contains data associated with geometries from the corresponding .shp file.
To learn more about the Shapefile format, refer to Shapefile (Wikipedia).
The image below illustrates country shapes, along with supplemental information (country names in a tooltip) loaded from a Shapefile.
Load Shapefile Data
To load shapes from a Shapefile, do the following.
- Create a ShapefileDataAdapter object.
- Specify the path to a Shapefile using the ShapefileDataAdapter.FileUri property.
- Assign the ShapefileDataAdapter object to the VectorLayer.Data property.
Note that in this case, data from a .dbf file is stored as attributes in each vector item object. This approach allows you, for instance, to use this data to colorize shapes or display supplementary information in shape tooltips.
To learn how to load vector data from a shapefile, see the How to: Load Data from a Shapefile example.