beautypg.com

Pitney Bowes MapXtreme User Manual

Page 594

background image

Appendix I: User-Defined Metadata

User-Defined Metadata Support for TableInfoServer Queries

MapXtreme v7.1

601

Developer Guide

If a MapCatalog entry is known to exist which provides default metadata for the spatial column, a
"sparse" hint can be used as a means of overriding specific properties. Usually these would be
preference variety properties such as default view and default style, although any set of the
properties can be overridden depending upon the unique requirements of the complex query.

ColumnHints are not intended to be used for (x,y) data tables. For these, SpatialSchemaXY should
continue to be used. When a SpatialSchemaXY is applied to a table, any associated ColumnHints
are disregarded.

Since a MapXtreme table currently supports only a single FeatureGeometry column, the Columns
collection is expected to contain no more than a single FeatureGeometry column definition;
however, there's nothing in the Columns collection that precludes users from adding in as many as
they'd like. In this case, the last non-sparse value encountered for each property is the one that will
be honored in compiling the final metadata definition.

Applying a Style Column Hint

A Style column hint may be applied as a way of indicating that a column within the query result
contains values (notably, MapBasic style strings) used to create Style instances for each feature,
which correspond to the associated FeatureGeometry within the feature. For example, if a query
returns a column named mb_style that contains MapBasic style strings, we could construct the hint
and add it into the hints collection (from above) as follows:

[C#]
Column styleCol = new Column("mb_style", MIDbType.Style);
hints.Add(styleCol);

Since a table currently supports only a single Style column, the hints collection is expected to contain
no more than a single Style column definition; however, there's nothing in the Columns collection
that precludes users from adding in as many as they'd like. In this case, the last one inserted is the
one that will be honored.

Style column hints are not required within the hints collection. If the query does not contain a column
containing style information, this hint can be excluded.

KeyType and KeyColumns Properties

Each table must have a "key" that provides a unique value for each feature (row) within the table.
While not supplied by the MapCatalog, this is another important piece of metadata that is inferred for
remote database tables by looking at things like primary key definitions.

Many of the content sources listed above, as well as tables containing only composite primary keys,
also present challenges for inferring a unique key to use. In these situations, the KeyType and
KeyColumns properties provided through the base TableInfo class can be used to provide explicit
instructions. For example, consider a database view of customer information that contains a column
named CUSTID that is known to contain unique and non-null values. We can direct this column to be
used as the key for the resulting MapXtreme table as follows:

[C#]
tblInfoSrv.KeyType = KeyType.Explicit;
StringCollection keyColumns = new StringCollection();
keyColumns.Add("CUSTID");
tblInfoSrv.KeyColumns = keyColumns;