locked
Postgis shp2pgsql output compatible with SQLServer 2008? RRS feed

  • Question

  • Hi all,

    after having some trouble with the free shp2sql shapefile loader: Postgis' shp2pgsql produces SQL-INSERT-scripts. Are these INSERT's very specific for Postgis/Postgres, or does SQLServer 2008 TSQL interpreter understand them, too? (maybe with some modifications). 

    Regards,

    Klaus

    Monday, January 10, 2011 10:21 AM

Answers

  • Hello Tanoshimi,

    sorry, it took some time, but now I was successful in using the OGR converter library (Open Source, ownload at http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries), which supports SQLServer Spatial as target format, too. Seems to be a very nice tool. No problems in importing several types of ESRI shapes!

    Regards,

    Klaus

    • Marked as answer by Tom Li - MSFT Saturday, January 22, 2011 5:59 AM
    Wednesday, January 19, 2011 11:22 AM

All replies

  • Hi,

    I've not used shp2pgsql, but I'd be very surprised if you could use its output directly in SQL Server. However, so long as it generates T-SQL INSERT statements where the geometry data is stated in Well-Known Text format (or Well-Known Binary), then it should be possible to modify the script output to use in SQL Server instead.

    If you can paste a single line of an output it creates here, it'll be pretty easy to tell straightaway.

    What problems were you having with shp2sql? If the problem is caused by a dodgy SHP file, then it won't matter what program you try to use - it will still be duff data.


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Monday, January 10, 2011 10:56 AM
    Answerer
  • Hello Tanoshimi,

    thanks for your quick answer. I will try to show you an output example of shp2pgsql in the next days.

    Kind Regards,

    Klaus

    Monday, January 10, 2011 1:49 PM
  • Hello Tanoshimi,

    sorry, it took some time, but now I was successful in using the OGR converter library (Open Source, ownload at http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries), which supports SQLServer Spatial as target format, too. Seems to be a very nice tool. No problems in importing several types of ESRI shapes!

    Regards,

    Klaus

    • Marked as answer by Tom Li - MSFT Saturday, January 22, 2011 5:59 AM
    Wednesday, January 19, 2011 11:22 AM