Questions tagged «shp2pgsql»

4
我在postgis安装中找不到shp2pgsql
我已经按照本指南安装了postgis 。一切都OK。 SELECT postgis_full_version(); "POSTGIS="2.1.7 r13414" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" TOPOLOGY RASTER" 但是我没有看到shp2pgsql,/usr/lib/postgresql/9.4/bin如您所见: foo@bar:/usr/lib/postgresql/9.4/bin$ ls clusterdb initdb pg_dump pg_standby psql createdb oid2name pg_dumpall pg_test_fsync reindexdb createlang pg_archivecleanup pg_isready pg_test_timing vacuumdb createuser pg_basebackup pg_receivexlog pg_upgrade vacuumlo dropdb pgbench pg_recvlogical pg_xlogdump droplang pg_controldata …

1
将多个shapefile批量加载到Postgis
根据shp2pgsql帮助,选项drop,append,create和prepare是互斥的。因此,如果我想从形状创建表,然后附加多个其他shapefile,我将执行以下操作,并保留一个计数器以指示我们处于创建还是附加模式。 cnt=0 for shp in $(ls *.shp); do if [ $cnt -eq 0 ] ; then shp2pgsql -s 27700 -c $shp schema.table_name | psql -h localhost db else shp2pgsql -s 27700 -a $shp schema.table_name | psql -h localhost db fi ((cnt++)) done 这可以按预期工作,但我经常想知道是否有更简单的方法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.