Shape Data - ShapeDataLayer


 

Spatial data may be stored in general-purpose databases which do not have support for spatial indexes. The ShapeDataLayer class can be used to access and edit such spatial data. The database table should contain a BLOB (binary large object) column with binary spatial data . The format of the data must conform to the ESRI Shapefile format specification.

 

A sample table in an Access database may look as the following:

NAME            TYPE
-----------------------
ID              COUNTER
CITY_NAME       TEXT
STATE_NAME      TEXT
POPULATION      NUMBER
SHAPEDATA  OLE

 

The SHAPEDATA field stores shapes in the Shapefile format.

 

Create a ShapeDataLayer object and pass the connection string, table name and SHAPEDATA field to its constructor. It is also necessary to specify the FieldList property if you need attribute data for labeling or editing.

 

Add the ShapeDataLayer to the Map control using the AddLayer method:

Imports AspMap
Imports AspMap.Data

Dim connectionString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\MAPS\MapData.mdb"
Dim tableName As String = "cities"
Dim providerName As String = "System.Data.OleDb"

Dim shapeData As ShapeDataLayer 

shapeData = New ShapeDataLayer(providerName, connectionString, tableName, "SHAPEDATA")
shapeData.FieldList = "ID, CITY_NAME, POPULATION"

Dim layer As Layer = map.AddLayer(shapeData)

 

The ShapeDataLayer class supports editing of data as described in the Editing Spatial and Attribute Data topic.


 

Note: If you use only database layers in your application, it must be necessary to specify the extent of each database layer. By default, the extent is set to (-180,90,180,-90) where the units are decimal degrees. The extent of a database layer can be set via the Extent property. If an incorrect extent is set, the database layer will not be visible.



© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)