Skip to content

Instantly share code, notes, and snippets.

@bradbrowne
Last active September 30, 2020 06:23
Show Gist options
  • Save bradbrowne/c732e06c38ee9fb61af0 to your computer and use it in GitHub Desktop.
Save bradbrowne/c732e06c38ee9fb61af0 to your computer and use it in GitHub Desktop.
Export Shapefile from SQL Server using ogr2ogr
ogr2ogr -f "ESRI Shapefile" "PROPERTY_VIEW.shp" "MSSQL:server=.;database=Flux;tables=vmprop.PROPERTY_VIEW;trusted_connection=yes" -t_srs EPSG:28355 -sql "SELECT [PFI],[SP_GEOMETRY] FROM [vmprop].[PROPERTY_VIEW]" -overwrite
@bradbrowne
Copy link
Author

Create an Esri Shapefile from the SQL Server table, which is easy to do using ogr2ogr, and ensuring that the output projection is specified using -t_srs so that the .prj file is written as well.

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