SqlServerDataSet Class
A dataset that reads spatial data from a Microsoft SQL Server database.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CEDataSets assembly)
Syntax
public class SqlServerDataSet : DatabaseDataSet
Remarks
This dataset reads spatial data stored in a Microsoft SQL Server database version 2008 or later. In Microsoft SQL Server 2008, spatial extensions based on the OpenGIS geometry model were introduced.
The database table that should be read by the dataset have to satisfy the following requirements:
The column used as the KeyColumn must be of integer type.
The column used as the GeometryColumn must be of type GEOMETRY or GEOGRAPHY.
The table containing the geometry data should have a spatial index.
When using the GEOGRAPHY data type and the view area might exceed a single hemisphere make sure the compatibility level for the database is set to SQL Server 2012 or later.
The <server name> part of the ConnectionString property can include the port number and instance name by using the following format:
<host name>\<instance name>,<port number>
To use a trusted or secure connection to SQL Server leave the User property empty.
The following data types can be read and stored as attributes:
Attribute data type | Database data type |
---|---|
Integer | BIGINT, INT, SMALLINT, TINYINT |
Floating point number | DECIMAL, FLOAT, NUMERIC, REAL |
Boolean | BIT |
String | CHAR, NCHAR, NVARCHAR, VARCHAR, DATE, DATETIME, DATETIME2, SMALLDATETIME, TIME |
When a SqlServerDataSet reads a multi geometry from the database it will be split into separate parts. For example, a multi point will result in one or more point features. The Feature.Id of each part will be the same which can be used to identify which parts belong to which multi geometry. Each part will also have a sourceGeoType attribute that specifies the kind of multi geometry it was originally a part of. The following table lists the possible values (remember that when atoms are specified in Carmenta Studio they always begin with a hash mark):
Value of sourceGeoType | Description |
---|---|
multiPoint | Indicates that a point feature was originally part of a multi-point. |
multiLine | Indicates that a line feature was originally part of a multi-line. |
multiPolygon | Indicates that a polygon feature was originally part of a multi-polygon. |
multiGeometry | Indicates that a vector feature was originally part of a multi-geometry. |
Microsoft SQL Server specific options that can be set in the Options property:
Name | Description |
---|---|
DBPROP_INIT_TIMEOUT | Indicates the amount of time (in seconds) to wait for initialization to complete. |
DBPROP_COMMANDTIMEOUT | The number of seconds before a command times out. A value of 0 indicates an infinite time-out. |
Prerequisites
To be able to use this dataset, additional database-specific client software must be installed on the machine.
Windows
For Windows "Microsoft OLE DB Driver for SQL Server" should be installed. Follow Microsofts instructions for installing the driver for the correct Windows version. If using the default driver installed with Windows, even if using the default port, you might need to specify the port in the connection string, i.e. "databaseserver,1433@database".
Linux
For Linux "Microsoft ODBC Driver for SQL Server" should be installed. Follow Microsofts instructions for installing the driver for the correct Linux version.
Inheritance Hierarchy
System.Object (not available in C#)
EngineObject
ResourceObject
DataSet
DatabaseDataSet
SqlServerDataSet
Platforms
Windows, Linux, Android
SqlServerDataSet Members
The SqlServerDataSet type has the following members.
Constructors
Name | Description |
---|---|
SqlServerDataSet | Initializes a new instance of the SqlServerDataSet class. |
Properties
Name | Description |
---|---|
IReadAttributes.Attributes | Gets a collection whose contents determine which attributes will be read the DataSet. Inherited from IReadAttributes |
Bounds | Gets or sets the bounding rectangle of the dataset. Inherited from DataSet |
CommandTimeout | Gets or sets a value indicating how long the dataset should wait before considering a command as failed. Inherited from DatabaseDataSet |
ConnectionString | Gets the connection string used to connect to the database. Inherited from DatabaseDataSet |
ConnectTimeout | Gets or sets a value indicating how long the dataset should wait before considering a connection attempt as failed. Inherited from DatabaseDataSet |
Crs | Gets or sets the coordinate reference system of the SqlServerDataSet. Inherited from DataSet |
Description | Gets or sets a short description of the dataset. Inherited from DataSet |
DisplayName | Gets or sets a display name for the dataset. Inherited from DataSet |
GeometryColumn | Gets or sets the name of the column that contains the geometry of spatial data. Inherited from DatabaseDataSet |
Id | Gets a unique identifier for this dataset instance. Inherited from DataSet |
IsDisposed | Gets a value that tells whether the current SqlServerDataSet has been disposed. Inherited from EngineObject |
IsolationLevel | Gets or sets the isolation level of database transactions. Inherited from DatabaseDataSet |
IsoMetadataDocument | Gets or sets the path to an ISO 19139 metadata document for the dataset. Inherited from DataSet |
KeyColumn | Gets or sets the name of the column that is used as the identity of the generated features. Inherited from DatabaseDataSet |
Name | Gets or sets the name of the SqlServerDataSet. Inherited from ResourceObject |
NativeHandle | Gets the native Carmenta Engine kernel object the current SqlServerDataSet represents. Inherited from EngineObject |
Options | Gets or sets an AttributeSet that contains database connection options. Inherited from DatabaseDataSet |
Password | Gets or sets the password used when connecting to the database. Inherited from DatabaseDataSet |
IReadAttributes.ReadAttributes | Gets or sets a value indicating whether the DataSet reads attributes. Inherited from IReadAttributes |
Srid | Gets or sets the Spatial Reference Identifier to use in SQL queries. Inherited from DatabaseDataSet |
SuppressInitializationErrors | Gets or sets a flag indicating how errors during dataset initialization are handled. Inherited from DataSet |
SwitchXY | Gets or sets a value that determines whether the x and y-coordinates are switched. Inherited from DatabaseDataSet |
Table | Gets or sets the name of the table that the dataset reads from. Inherited from DatabaseDataSet |
ThrowExceptions | Gets or sets a flag indicating if exceptions should be thrown when an error occurs. Inherited from DatabaseDataSet |
User | Gets or sets the name of the user that is used when connecting to the database. Inherited from DatabaseDataSet |
IUserProperties.UserProperties | Gets the AttributeSet that contains the user properties. Inherited from IUserProperties |
Methods
Name | Description |
---|---|
Clone | Creates a copy of an object. Inherited from EngineObject |
Dispose | Releases the reference to the native Carmenta Engine kernel instance the EngineObject represents. Inherited from EngineObject |
Equals | Determines whether this instance is equal to another. Inherited from EngineObject |
FindChildObject | Overloaded. Finds the child object with the specified name. Inherited from DataSet |
FlushCache | Frees any information the dataset may have cached, including all cached features. Inherited from DataSet |
GetChildObjects | Overloaded. Gets the child objects of the current object. Inherited from DataSet |
GetDataCoverage | Gets coverage information for this dataset in a given area. Inherited from DataSet |
Looks up an existing dataset instance from a dataset identity. Inherited from DataSet | |
GetDataSetInfo | Returns a dataset info that describes the contents of this dataset. Inherited from DataSet |
GetDataSetInfoAsync | Makes an asynchronous call to GetDataSetInfo. Inherited from DataSet |
GetFeature | Gets the feature with the specified identity. Inherited from DataSet |
GetFeatures | Overloaded. Gets features from the dataset. Inherited from DataSet |
GetFloatValueAt | Overloaded. Gets the float raster value from a cell at the specified position. Inherited from DataSet |
GetFloatValuesAt | Overloaded. Gets a number of float raster values. Inherited from DataSet |
GetLocalizedDescription | Gets a localized version of the dataset description in a specific language. Inherited from DataSet |
GetLocalizedDisplayName | Gets a localized version of the dataset display name in a specific language. Inherited from DataSet |
GetLocalizedIsoMetadataDocument | Gets the path to an ISO 19139 metadata document for a specific language. Inherited from DataSet |
GetNormalizedFloatValueAt | Overloaded. Gets the raster value from a cell at the specified position, normalized by Scale and Offset. Inherited from DataSet |
GetNormalizedFloatValuesAt | Overloaded. Gets a number of raster values, normalized by Scale and Offset. Inherited from DataSet |
GetTableInformation | Obtains information about a database table. Inherited from DatabaseDataSet |
GetValueAt | Overloaded. Gets the integer value from a raster cell at the specified position. Inherited from DataSet |
GetValuesAt | Overloaded. Gets a number of raster values. Inherited from DataSet |
HasLocalizedDescription | Checks if a localized version of the dataset description is available in a specific language. Inherited from DataSet |
HasLocalizedDisplayName | Checks if a localized version of the dataset display name is available in a specific language. Inherited from DataSet |
HasLocalizedIsoMetadataDocument | Checks if an ISO 19139 metadata document is available for a specific language. Inherited from DataSet |
HighestRasterValue | Finds the highest raster value inside the given polygon. Inherited from DataSet |
Initialize | Initializes the dataset. Inherited from DataSet |
IsConnected | Checks the database connection status. Inherited from DatabaseDataSet |
Reconnect | Reconnects to the database. Inherited from DatabaseDataSet |
SetLocalizedDescription | Sets a dataset description in a specific language. Inherited from DataSet |
SetLocalizedDisplayName | Sets a dataset display name in a specific language. Inherited from DataSet |
SetLocalizedIsoMetadataDocument | Sets the path to an ISO 19139 metadata document for the dataset, for a specific language. Inherited from DataSet |
StartConnect | Starts a connection to the database, without waiting for it to complete. Inherited from DatabaseDataSet |
TryGetFloatValueAt | Overloaded. Gets the float value from a raster cell at the specified position. Inherited from DataSet |
TryGetNormalizedFloatValueAt | Overloaded. Gets the float value from a raster cell at the specified position, normalized by Scale and Offset. Inherited from DataSet |
TryGetValueAt | Overloaded. Gets the integer value from a raster cell at the specified position. Inherited from DataSet |