TransWikia.com

How do I update a polygon with values from a line in GRASS

Geographic Information Systems Asked by vinh on March 8, 2021

I have a line map generated from r.stream.extract. I also have a polygon map generated from r.stream.basins, using the raster stream layer generated from r.stream.extract.
I want to update the polygon layer with the category and one of the attributes of each line.
Each polygon contains one and only one line, which touches the boundary at either one or two points.

In PostGIS, I’d do something like the following:

UPDATE poly_table a 
SET line_cat = (
    SELECT line_cat FROM line_table b 
    WHERE st_contains(a.geom, b.geom)
);

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP