[gdal-dev] Convert shapefile to SQL text for PostGIS
Brice Lambi
lambi at ucar.edu
Tue May 11 12:43:26 EDT 2010
I just stumbled on this while looking for something completely
different, shp2pgsql:
http://postgis.refractions.net/docs/ch04.html
The shp2pgsql data loader converts ESRI Shape files into SQL suitable
for insertion into a PostGIS/PostgreSQL database either in geometry or
geography format. The loader has several operating modes distinguished
by command line flags:
In addition to the shp2pgsql command-line loader, there is an
shp2pgsql-gui graphical interface with most of the options as the
command-line loader, but may be easier to use for one-off non-scripted
loading or if you are new to PostGIS. It can also be configured as a
plugin to PgAdminIII.
Brice Lambi wrote:
> You can use shp2text:
>
> http://www.obviously.com/gis/shp2text/
>
> It won't output the insert statements directly but it will create a tab
> delimited file that you could then parse into your database.
>
>
>
> Aleksey Naumov wrote:
>> Dear GDAL users,
>>
>> Is there a way to use ogr2ogr or other means to convert a layer (e.g. a
>> shapefile) into an SQL text file suitable for insertion into PostGIS? In
>> other words, a file with SQL text like:
>>
>> INSERT INTO "my_table" ("the_geom" ) VALUES
>> (GeomFromEWKT('SRID=-1;POLYGON (( ...))'::TEXT) );
>>
>> which could be read into PostgreSQL later. Ideally, I am looking for a
>> direct conversion, i.e. not involving PostGIS.
>>
>> Thank you,
>> Aleksey
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list