Skip to main content

Provide Cartesian Data to a Geographical Map

  • 2 minutes to read

This document describes how to load Cartesian coordinate data onto a geographical map. The document consists of the following sections.

Overview

The ShapefileDataAdapter allows loading both Cartesian and geographical map data. To specify which kind of data the adapter should load, customize the CoordinateSystemDataAdapterBase.SourceCoordinateSystem property.

This property is set to null by default and to load Cartesian data, set this property to CartesianSourceCoordinateSystem.

ShapefileDataAdapter_SourceCoordinateSystem

Load a Coordinate System Metadata from the *.PRJ File

If your data contains the *.PRJ file and this file is located in the same directory and has the same name as a shapefile, the coordinate system will be loaded automatically. Otherwise, if the paths or the names are different, call the ShapefileDataAdapter.LoadPrjFile method to load coordinate system metadata.

The following code demonstrates this situation.

data_Renamed.Add(New MapData() With {.Name = "LoadPrjFile( ) loaded coordinate system", .FileUri = New Uri(baseUri, "../../Shapefiles/Lambert/Belize.shp"), .CoordinateSystem = ShapefileDataAdapter.LoadPrjFile(New Uri(baseUri, "../../Shapefiles/Lambert/Projection.prj"))})

The following image demonstrates the result of loading coordinate system information from a *.PRJ file.

AutomaticallyLoadedCartesianGeoData

Specify Coordinate System Manually

If your data does not contain a *.PRJ file, it is possible to customize the Cartesian coordinate system manually. To do this, create a CartesianSourceCoordinateSystem object, specify its CartesianSourceCoordinateSystem.MeasureUnit and SourceCoordinateSystem.CoordinateConverter properties. Then, assign the object to the CoordinateSystemDataAdapterBase.SourceCoordinateSystem property.

The following code demonstrates this.

<dxm:ShapefileDataAdapter.SourceCoordinateSystem>
    <dxm:CartesianSourceCoordinateSystem>
        <dxm:CartesianSourceCoordinateSystem.CoordinateConverter>
            <dxm:AlbersEqualAreaConicCartesianToGeoConverter StandardParallelN="60.0" StandardParallelS="20.0"
                                                             Ellipsoid="{x:Static dxm:Ellipsoid.GRS80}"
                                                             ProjectionCenter="40,-96"/>
        </dxm:CartesianSourceCoordinateSystem.CoordinateConverter>
    </dxm:CartesianSourceCoordinateSystem>
</dxm:ShapefileDataAdapter.SourceCoordinateSystem>

The following image demonstrates the result.

CartesianDataLoadedManually

See Also