Skip to main content
A newer version of this page is available. .

How to: Load Data from a Shapefile

To load shape data from a shapefile do the following.

    // Create data for the MapLayer.
    MapLayer.Data = CreateData();
private MapDataAdapterBase CreateData() {
    Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);

    // Create an adapter to load data from shapefile.
    ShapefileDataAdapter adapter = new ShapefileDataAdapter() {
        FileUri = new Uri(baseUri, filename)
    };

    return adapter;
}