[gdal-dev] Error while importing shapefiles to Sql Server

Giampaolo giampaolo.rebuzzi at i-sti.net
Tue Mar 18 04:36:20 PDT 2014


Hi, thank you for your answer.
I already thought to create the tables with the first set of files and then
removing -nln but, with the succeeding sets (I don't have only 2 sets, but
250), ogr2ogr would create new tables with the original file names.
It would be nice to have a parameter similar to -nln that permits to specify
the layer name to append data to.

In the meanwhile I found Shape2Sql software that works as needed:

@ECHO OFF
setlocal EnableDelayedExpansion
echo Importing... 
for %%f in (*.shp) do (
set filename=%%~nf
set filenametrunc=!filename:~3!
Shape2Sql -shp="%%~dpnxf" -connstr="Data Source=.\SQLEXPRESS;Initial
Catalog=ShapeFiles;" -table=!filenametrunc! -srid=4326 -append=true
-geography=true
echo !filename! 
)
echo Completed
PAUSE

It puts data in the specified table and if the table doesn't exist, it first
create it.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Error-while-importing-shapefiles-to-Sql-Server-tp5129482p5129637.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list