Defining Feature Sources

AutoCAD Map 3D Geospatial Platform API

Defining Feature Sources

To define a feature source within AutoCAD Map 3D, create a resource identifier for the feature source and store it in the resource repository. Then call MgResourceService.SetResource() with three parameters:

  • An MgResourceIdentifier that contains the path in the resource repository for the resource.
  • An MgByteReader that provides the XML describing the feature source. This conforms to FeatureSource.xsd.
  • A null parameter for the resource header. This is not used by AutoCAD Map 3D.

The repository path is of the form


resourcePath is optional, but FeatureSource (case sensitive) is mandatory. For example, the following creates an MgResourceIdentifier:

MgResourceIdentifier parcelId = 
  new MgResourceIdentifier("Library://parcels.FeatureSource");

The exact form of the XML describing the feature source varies depending on the FDO provider. See the schema documentation for FeatureSource.xsd and the Connection API section of The Essential FDO for details. Different FDO providers accept different parameters, as described in The Essential FDO. For example, the Autodesk.Raster.3.2 provider accepts a single parameter, DefaultRasterFileLocation. This is set in a Name/Value parameter in the XML data.

<?xml version="1.0" encoding="utf-8"?>
  <LongTransaction />

Some providers require additional configuration. For example, the Autodesk.Raster.3.2 provider requires georeferencing information to define the location and resolution of the raster data for some raster file formats. This can be in a world file in the same folder as the raster file, or it can be in a separate FDO configuration file. WMS and ODBC providers can also require separate configuration files.

For those providers that do require a configuration file, the FeatureSource XML contains a <ConfigurationDocument> element that points to resource data. Call MgResourceService.SetResourceData() to set the data. The data name must match the name in the <ConfigurationDocument> element. The BuildMap sample uses config:// as part of the resource data name, but this is not required.