I'm trying to import a shapefile to SQL Server 2019. This command works:
ogr2ogr -f "MSSQLSpatial" "MSSQL:server=[myserver];database=test;tables=CAPZONE;UID=[myuser];PWD=[mypassword];driver={SQL Server}" "[myshapefile]" -lco GEOMETRY_NAME=GEOM -lco GEOM_TYPE=GEOMETRY -nln "CAPZONE" -a_srs "EPSG:4326" -overwrite -progress -skipfailures -lco UPLOAD_GEOM_FORMAT=wkt
But it creates the column with the data in SQL of type GEOMETRY
if I change the parameter GEOM_TYPE=GEOMETRY
to GEOM_TYPE=GEOGRAPHY
it also works (as in I don't get any errors) but the difference is that with the GEOMETRY
type the shapes are correct when I check in SQL instead with the GEOGRAPHY
type I only get a full page of color in the "spatial results" pane.
I need the GEOGRAPHY
type to be able to run some SQL functions not available with the GEOMETRY
type. I've also tried importing the GEOMETRY type and then using some SQL functions to convert to GEOGRAPHY
but the result is the same.
this is my [spatial_ref_sys] table:
Any ideas?
-----UPDATE------------
Adding parameter -nlt "LINESTRING" or "MULTILINESTRING" or "COMPOUNDCURVE" finally draws the right shapes but they aren't filled with colour for some reason:
anyone know why it isn't filling the up?
full page of color in the "spatial results" pane
looks like? is the whole globe filled with shapes?