Maptitude GISDK Help |
The GisdkDataAdapter class is used for translating a GISDK dataview or a selection set into an instance of the .NET System.Data.DataTable class. It includes type-safe methods for filling a DataTable schema and rows with values coming from a GISDK selection set, methods for updating a GISDK dataview with values coming from the DataTable, and methods for aggregating and transposing DataTables. This is based on ADO.NET, the data component of the .NET platform. It provides a common programming interface to a wide variety of proprietary data sources including SQL databases and OLEDB. In .NET, all tabular data is contained in a standard class, called System.Data.DataSet. A DataSet contains one or more related DataTables, and a collection of extended properties and relations that describe the content of the tables.
The CaliperForm.GisdkDataAdapter class is used for translating a GISDK dataview or a selection set into an instance of the .NET System.Data.DataTable class. It includes type-safe methods for filling a DataTable schema and rows with values coming from a GISDK selection set, methods for updating a GISDK dataview with values coming from the DataTable, and methods for aggregating and transposing DataTables.
Most importantly, this class implements the .NET System.Data.IDataAdapter interface, and allows you to use Maptitude as a data source anywhere you would use an SQL data source or an OLEDB data source. For example, you can use the GisdkDataAdapter class to bind Maptitude data to any data-bound control such as DataGrid and DataList.
The following example fills a DataTable with a GISDK selection set:
Dim Adapter As CaliperForm.GisdkDataAdapter
Adapter = New CaliperForm.GisdkDataAdapter(Gisdk, LayerName, SetName)
''' Name the DataTable and set the rows per fill
Adapter.TableName = "Airports"
Adapter.RowsPerFill = 10
''' Fill the DataTable
While (Adapter.SetRows > 0) AndAlso (Adapter.RowsLeft > 0)
NumFilled = Adapter.Fill(DataSet)
Adapter.CurrentRow = Adapter.NextRow
End While
The public methods for the GisdkDataAdapter class include:
Method |
Description |
Fill |
(Overloaded) Adds rows from a GISDK selection set to an ADO.NET DataTable object. |
Transfer |
Creates or restores a selection set ViewName|SetName with the rows corresponding to the rows in the input data table. |
Transpose |
Create a new table with the transposed version of a DataTable |
Aggregate |
Create a new table with the aggregates (sums, counts) of a DataTable |
Update |
Updates a view in the GISDK workspace based on the values stored in the changed rows of a DataTable. |
The GisdkDataAdapter class includes many properties that let you control how to fill a DataTable, including how to map the output column names to the input view column names, and the preferred XML output format.
The overloaded Fill method allows you to fill the DataTable with geographic information. For example, the following statements will fill the DataTable with an extra column that stores the distance of each row from a selected coordinate:
Dim Coord As Object = Gisdk.DoFunction("Coord",-73967252,40729245)
Dim LonField As String = "Longitude"
Dim LatField As String = "Latitude"
NumFilled = Adapter.Fill(DataSet,LonField,LatField,"Distance",Coord)
The following statements fill the DataTable with an extra string column that contains the geographic scope for each one of the features (rows) in the table. The scope values are formatted as "Center Longitude | Center Latitude | Feature Width | Feature Height."
Dim IDField As String = "ID"
Dim ScopeColumnName As String = "Scope"
NumFilled = Adapter.Fill(DataSet,IDField,ScopeColumnName)
The GisdkDataAdapter fills the DataTable with a copy of the data values from the selection set. If you don’t need the GISDK environment after you have filled the DataTable, you should disconnect from GISDK by calling the Connection.Close() method immediately after completing the GisdkDataAdapter.Fill() method, as follows:
NumFilled = Adapter.Fill(DataSet,IDField,ScopeColumnName)
''' If you don’t need GISDK, release it as soon as possible
Gisdk.Close()
©2025 Caliper Corporation | www.caliper.com |