Skip to main content
format code
Source Link
Chad Cooper
  • 12.7k
  • 4
  • 47
  • 87

ogr2ogr should do this for you. Looks like you have multiple geometry types in the dataset, not sure how that will work out. You might have to filter out by geometry type. Below not tested. See docs linked to above for inputs and flags.

ogr2ogr -f "GeoJSON" "sqlexport.geojson" "MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;" -sql "SELECT * FROM tbl"

ogr2ogr -f "GeoJSON" "sqlexport.geojson"
"MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;"
-sql "SELECT * FROM tbl"

ogr2ogr should do this for you. Looks like you have multiple geometry types in the dataset, not sure how that will work out. You might have to filter out by geometry type. Below not tested. See docs linked to above for inputs and flags.

ogr2ogr -f "GeoJSON" "sqlexport.geojson" "MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;" -sql "SELECT * FROM tbl"

ogr2ogr should do this for you. Looks like you have multiple geometry types in the dataset, not sure how that will work out. You might have to filter out by geometry type. Below not tested. See docs linked to above for inputs and flags.

ogr2ogr -f "GeoJSON" "sqlexport.geojson"
"MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;"
-sql "SELECT * FROM tbl"
Source Link
Chad Cooper
  • 12.7k
  • 4
  • 47
  • 87

ogr2ogr should do this for you. Looks like you have multiple geometry types in the dataset, not sure how that will work out. You might have to filter out by geometry type. Below not tested. See docs linked to above for inputs and flags.

ogr2ogr -f "GeoJSON" "sqlexport.geojson" "MSSQL:server=localhost\sqlexpress;database=tempdb;trusted_connection=yes;" -sql "SELECT * FROM tbl"