Monday, 21 September 2015

How to remove shapefile from PostGIS


I added a shapefile to the PostGIS using,


ogr2ogr -f PostgreSQL PG:"host=server_ip user=username dbname=dbname password=password" yourshapefile.shp;


Now I want to remove it. What is the command line code for that?


The table list is as follows \d,


List of relations
Schema | Name | Type | Owner
--------+----------------------+----------+---------
public | pimapine | table | smaranh
public | pimapine_ogc_fid_seq | sequence | smaranh
(2 rows)


And when I execute DROP TABLE public.pimapine there is no change to the output of \d.



Answer



The cleanest way is with the DropGeometryTable function. This will remove the table as well as entries in the geometry_columns table.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...