I've a PostGIS layer with read-only privileges. Is there any way to display the vertex markers of the layer?
-
Can't you generate a point layer from the read-only privileges layer using Vector > Geometry Tools > Extracts Nodes... and style accordingly if required?– ThomasG77Jan 20, 2016 at 22:46
-
1Do you just want to style the nodes on the layer? The vertex node markers are only used in edit mode.– Nathan WJan 20, 2016 at 23:36
2 Answers
No need to create a new layer. You can show your layer's vertices using the Outline: Marker line Symbol layer type.
Just add a new symbol layer
- Add a new symbol layer;
- Choose Outline Marker line (top right corner);
- In the Marker placement, Choose "On every vertex"
You can even style the marker to look like the red cross symbol used on layers in edit mode.
Do you have your own schema in which you can make a view that refers to your source table? If so, you can create the following view:
CREATE OR REPLACE VIEW polygon_vertices AS
SELECT row_number() OVER (ORDER BY (st_dumppoints(polygon.shape)).geom) AS objectid,
polygon.field1, -- fields you want to keep in the vertices
polygon.field2, -- that are in the polygon table
(st_dumppoints(polygon.shape)).geom::geometry(Point,4326) AS shape
FROM polygon;
This database view pulls apart each polygon and returns all the points (vertices) within the polygon's boundary.
Take note of the following:
(st_dumppoints(polygon.shape)).geom::geometry(Point,4326)
Calls the ST_DumpPoints function and then only the "geom" column returned by the function is kept. The type is explicitly cast. You will want to change that to the SRID of the "polygon" spatial column. (This isn't completely necessary, but I've found it to be good practice.)
row_number() OVER (ORDER BY (st_dumppoints(polygon.shape)).geom) AS objectid
Is necessary to create a unique identifier column, required by most desktop GIS applications, including QGIS.