0

I am trying to import a Shapefile with polygon features into MSSQL database with this command:

ogr2ogr -f "MSSQLSpatial" "MSSQL:server=***;uid=***;pwd=***;database=***" "D:\GeoData\processed\usage_land.shp" -a_srs "EPSG:4326" -nlt "POLYGON" -nln "import_usage" -progress -skipfailures

Import does work so far but the geometry column ogr_geometry stays NULL. Any ideas how to get this feature working? Which command am I missing?

5
  • what does ogrinfo say about the shapefile - most likely issue is multipolygon to polygon column – Ian Turton Jan 20 at 15:10
  • Polygon - tried other geometry types in -nlt command as well (geometry, multipolygon) – Brian M. Degarro Jan 20 at 15:15
  • do you end up with a geometry column called the_geom? – Ian Turton Jan 21 at 8:21
  • No, its ogr_geometry initially, but I added -lco "GEOMETRY_NAME=geometry" for my purpose – Brian M. Degarro Jan 21 at 8:51
  • I would try without --skipfailures and see if there is an error – Ian Turton Jan 21 at 9:14
0

Looks like I found the answer: https://stackoverflow.com/questions/52259696/ogr2ogr-does-not-create-tables

I was missing the -lco UPLOAD_GEOM_FORMAT=wkt and this seemed to do the job!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.