Friday 24 November 2017

PostgreSQL trouble editing points / lines / polygons in QGIS


I have a problem with postgresql and QGIS :



  • I can add points/lines/polygons and fillup field



But I can't :



  • delete points/lines/polygons

  • modify points/lines/polygons (move or modify field)


ex : dbname='Europe' host=localhost port=5432 user='postgres' sslmode=disable key='tid' estimatedmetadata=true srid=900913 type=Point table="public"."planet_osm_point" (way) sql=


QGIS is connected as admin level into database. With pdAdmin III I can do all (create, delete, modify...)


The postgresql database is imported from OSM with osm2pgsql.


On other layer, like .shp, I don't have this issue.



Any idea ?


Config : Ubuntu 14.04 / Posgresql 9.4 / QGIS 2.10



Answer



Fixed. The problem was is no primary key.


In pgAdmin do this request.


ALTER TABLE tableName ADD PRIMARY KEY (id);


Example for planet_osm_line table and setting osm_id column ,as primary key :


ALTER TABLE planet_osm_line ADD PRIMARY KEY (osm_id);


untill osm_id is unique.


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...