2

I have a polyline feature class with short and very long features. The goal is to density the vertices of the line features by percentage (of length or original amount of nodes or whatever). "curvy" lines should get more nodes by choosing densification by 80% then straight lines with few nodes. Is there something in qgis? I just know densification by a adding a specific number of nodes or by certain distance.

2 Answers 2

1

The inbuilt QGIS "Densify by Count" algorithm effectively densifies using a percentage. E.g. adding 2 vertices per segment causes the new vertices to be placed at 33% and 66% along each line segment.

If you first ran your input through a "simplify" algorithm, then any redundant points on straight portions of the linestring will be removed. You'd have an input with more segments in the "jagged" portions of the lines, and could potentially use this as the input to the "densify by count" algorithm to get your desired output.

0

From the PostGIS standpoint - you can take any feature and count the number of nodes with SQL and the ST_DumpPoints() function:

select id
     , count(*) as node_count
from
    (
    select s.id, (st_dumppoints((s.geom))).geom
    from ccd."CCD_StreetCenterlines" as s
    where s.id = '103872' --optional where clause on 1 feature

    group by s.id
    ) as data

group by id

Which yields:

id      node_count
103872  10

With the count, you could also add the length of the line ( ST_Length() ) and create a third column that is a product of number of nodes and the length of the line.

However, I would wonder how you would define "curvy" if that was going to play into your analysis...

Lastly, if you're limited to shapefiles, I believe most of these functions are available in the DBManager implementation of SQLite on a Shapefile layers (Feature class is an ArcGIS-only term, which I will assume you mean Shapefile).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.