[postgis-users] Newbie question - remove duplicate / identical feature in postgis
Jean David TECHER
david.techer at davidgis.fr
Thu Nov 13 07:52:10 PST 2008
Example:
dbname = routing_db
table =wr
1. Load only the table structure not the datas
use -p option taken from shp2pgsql
shp2pgsql -p wr.shp wr|psql routing_db
2. Add a constraint on the_geom column
psql routing_db
ALTER TABLE wr ADD CONSTRAINT check_unique_the_geom unique(the_geom);
3. Load your datas without 'BEGIN' and 'END'
* Here use the -a option taken from shp2pgsql
* use -I for index creation
The idea is to use the INSERT command in order to rollbacking if the
current feature is already in the table
N.B: don't use -D option!
shp2pgsql -aI wr.shp wr|grep -v ^BEGIN|grep -v ^END|psql routing_db
Quoting Intengu Technologies <sindile.bidla at gmail.com>:
> I have a polygon shapefile that has duplicate features which I want to load
> into Postgis. How can I ensure that each feature has only one record.
>
> --
> Sindile Bidla
>
===================
Jean David TECHER
www.davidgis.fr
06 60 46 85 05
04 99 77 16 87
===================
More information about the postgis-users
mailing list