sql-servershapefile

How to import a shape file into SQL Server?


In the past I have used shape2sql to import shape files into SQL Server.

I tried that route again on a newer Windows 10 box, and nothing seems to happen when trying to use that application.

Any suggestions for either getting shape2sql to work, or alternative ways to upload shape files into SQL Server?


Solution

  • So, it turns out that ogr2ogr has the ability to import directly into a SQL Server database now. I created a temporary database and did the following:

    ogr2ogr -overwrite -f MSSQLSpatial -lco “GEOM_TYPE=geography” -a_srs "EPSG:4326" "MSSQL:server=.;database=temp_import;trusted_connection=yes" "[path to shape file]"