By Partha
Sarkar
This is in continuation of my earlier posts on AutoCAD Map 3D API Training content: Part-1 , Part 2 & Part-3
. In
this post I am going to share some insights of “Feature Service” in Geospatial
Platform API used by Map 3D and AIMS.
The Feature Service
provides a data source agnostic API for the storage and retrieval
of feature data. We can use Feature Service API to determine which storage
technologies are available and their capabilities. For example, an Oracle
Spatial database will have more capabilities than an ODBC connection. Some
feature sources can have multiple schemas. Access to the data storage
technology is modeled as a connection. For example, you can connect to a file
and do simple insertions or connect to a relational database and do
transaction-based operations.
public class AcMapFeatureService : MgFeatureService is
part of Autodesk.Gis.Map.Platform namespace. Using AcMapServiceFactory.GetService() method and by specifying the correct MgServiceType[.FeatureService] we
access AcMapFeatureService like the following code
snippet -
static AcMapFeatureService fs = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as AcMapFeatureService;
The base MgFeatureService has very useful method to create / update / manipulate features
(FDO Features) in a particular data store. Some of the useful methods of MgFeatureService are -
Connection to a datastore. MgFeatureService::GetFeatureProviders, MgFeatureService::GetConnectionPropertyValues, MgFeatureService::TestConnection
Method (CREFSTRING, CREFSTRING) , and MgFeatureService::TestConnection Method (MgResourceIdentifier*)
Description of the capabilities of the FDO provider providing
access to the datastore. MgFeatureService::GetProviderCapabilities.
Insertion, deletion and update of feature data. MgFeatureService::UpdateFeatures,
MgInsertFeatures, MgDeleteFeatures, and MgUpdateFeatures.
Selection of feature data. MgFeatureService::SelectFeatures and MgFeatureService::SelectAggregate.
Description of the schema used to store feature data. MgFeatureService::DescribeSchema,
MgFeatureService::DescribeSchemaAsXml, MgFeatureService::GetSchemas,
MgFeatureService::SchemaToXml, MgFeatureService::GetClasses and
MgFeatureService::GetClassDefinition.
Creation of an SDF feature source to cache feature data from
other datastores. MgFeatureService::CreateFeatureSource. Using the latter
requires describing the schema in the source datastore. Transporting the
features from the source datastore requires selecting them from the source and
inserting them in the target.
Execute SQL commands. MgFeatureService::ExecuteSqlNonQuery
and MgFeatureService::ExecuteSqlQuery.
Get
the spatial contexts contained in the datastore. MgFeatureService::GetSpatialContexts.
Some of the previous blog posts show how to create / insert /
update / manipulate Feature Data in FDO data store -
How
to create FDO Feature using Geospatial Platform API in Map 3D?
Read
FDO Features using Map 3D Geospatial Platform API
Read
FDO Geometry Area using Map 3D Geospatial Platform API
How
to modify / update Feature attribute using API in Map 3D?
Using
FDO API to select Features from FDO Data Source
Selecting
FDO Features inside a given boundary (Polygon)
Manipulate
non-feature class with Geospatial Platform API in Map 3D
AcMapFeatureService class also has a useful
set of FeatureService Events which occur when feature-related actions, such as
deletion, insertion or update are initiated, concluded or cancelled -
Attached
Chapter 4 will help
you to understand working with ' FeatureService' and associated APIs which you
would require in your application development using Geospatial Platform API and
AutoCAD Map 3D.
I
hope this is useful to you!