Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Last active September 5, 2019 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soiqualang/52cbea911e668a788e43b498f7b7a63f to your computer and use it in GitHub Desktop.
Save soiqualang/52cbea911e668a788e43b498f7b7a63f to your computer and use it in GitHub Desktop.
[OGR2OGR] MSSQLSpatial - Microsoft SQL Server Spatial Database

[OGR2OGR] MSSQLSpatial - Microsoft SQL Server Spatial Database

Creating a layer from an OGR data source

ogr2ogr -overwrite -f MSSQLSpatial "MSSQL:server=.\MSSQLSERVER2008;database=geodb;trusted_connection=yes" "rivers.tab"

Connecting to a layer and dump the contents

ogrinfo -al "MSSQL:server=.\MSSQLSERVER2008;database=geodb;tables=rivers;trusted_connection=yes"

Creating a spatial index

ogrinfo -sql "create spatial index on rivers" "MSSQL:server=.\MSSQLSERVER2008;database=geodb;trusted_connection=yes"

Refer:

https://gdal.org/drivers/vector/mssqlspatial.html

https://gdal.org/programs/ogr2ogr.html

https://h-savran.blogspot.com/2017/09/how-to-create-geojson-in-sql-server.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment