im trying to import some shapes to SQL using ogr2ogr command following this guide https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/
Im using this command:
ogr2ogr -overwrite -f MSSQLSpatial [connection string] [shapefile] -nln "shape3" -nlt GEOMETRY
and getting this error:
ERROR 1: INSERT command for new feature failed. [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.shape3'. ERROR 1: Unable to write feature 0 from layer tl_2010_06_zcta510. ERROR 1: Terminating translation prematurely after failed translation of layer tl_2010_06_zcta510 (use -skipfailures to skip errors)
The command does not create the table and the inserts fails.
I tried to create the table first and using the command to insert on it:
ogr2ogr -f "MSSQLSpatial" [connection string] [shapefile] -a_srs "ESPG:4269" -lco "GEOM_TYPE=geography" -lco "GEOM_NAME=area" -nln "shapes3"
It works fine exept that it does not load the GEOGRAPHY colum (area), it remains NULL.
Im using the file provided in the guide and the user in the connection string is the admin so it is not a permission problem.
Thank you all in advance.
Memory Contention SQL Server caches the databases in what's called a buffer pool. A buffer pool acts as a storage space for data pages that have been recently written or read to and from disk. A small buffer pool will slow down your SQL application by overwhelming the disk's subsystem.
Reasons for Slow Database Performance Database/Query: There may be redundant query lines, complex or looping syntaxes, query deadlocks, lack of proper indexing, improper partitioning of database tables, etc.
Solved it adding -lco UPLOAD_GEOM_FORMAT=wkt to the command, its related to some geometry formating.
UPLOAD_GEOM_FORMAT: (From GDAL 2.0.0) Specify the geometry format (wkb or wkt) when creating or modifying features. The default is wkb. https://www.gdal.org/drv_mssqlspatial.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With