Spatial Database Settings
You can export data to a Microsoft SQL Server (Microsoft SQL Server 2008 and later) or PostgreSQL spatial database by entering the parameters needed to build a valid connection string.
"MSSQL:server=<server_name>\<server_name>;database=<Database>;tables=<schema>.<table>;trusted_connection=yes"
Server
Specify the name of the server where the database you are connecting to is stored.
Database
Specify the name of a database located on the server.
Host
For PostgreSQL, enter the name of the host for the database. This must be a resolvable host name such as would be used to open a TCP/IP connection or ping the host. If the database is on the same computer as the GIS system, simply enter localhost.
Port
Enter the port number that the PostgreSQL database server listens on. The default port for PostGIS is 5432:
Tables
If the table field is left blank, all spatial tables in the database are included.
To export to a particular table column, the column name must be omitted in the Tables field and specified in the Parameters field using the GEOM_NAME parameter flag, as shown in the following example:
If a Column parameter is not specified, a default Column name "ogr_geometry" is used instead.
Parameters
Extra parameters may be specified in addition to the standard parameters of the connection string. A working knowledge of SQL Server connection strings is assumed.
For more information, refer to:
Parameter | Description |
---|---|
GEOM_TYPE | The GEOM_TYPE layer creation option can be set to one of geometry or geography. If this option is not specified the default value is geometry. If this option is set to geography, the layer must have a valid spatial reference of one of the geography coordinate systems defined in the sys.spatial_reference_systems SQL Server metadata table. Projected coordinate systems are not supported in this case. |
OVERWRITE | This is currently forced to be YES (an existing layer of the same name is destroyed before creating the new layer). |
LAUNDER | The default value is YES. This forces new fields created on this layer to have their field names laundered into a form more compatible with MSSQL. This converts to lower case and converts some special characters like - and # to _. The table (layer) name will also be laundered. If this option is set to NO, exact names are preserved. |
PRECISION | The default is YES. This forces new fields created on this layer to try and represent the width and precision information, if available, using numeric(width,precision) or char(width) types. If this option is set to NO, then the types Float, Int and Varchar are used instead. |
DIM={2,3} | DIM is managed through the Output mode switch on the Export Cad/GIS form (and controls the dimension of the layer). |
GEOM_NAME | Sets the name of a geometry column in the new table. If omitted it defaults to OGR_GEOMETRY. |
SCHEMA | Sets the name of the schema for the new table. If this parameter is not supported the default schema dbo is used. |
SRID | Sets the spatial reference ID of the new table explicitly. The corresponding entry should already be added to the spatial_ref_sys metadata table. If this parameter is not set, the SRID is derived from the authority code of the source layer SRS. |
User
Where access to the database requires user credentials, enter the User name.
Password
Enter the Password for the User to access the specified database.
WKB (Well Known Binary) geometry format is only supported in SQL Server 2012 and later.