[Qgis-user] Setting a line's length attribute

Andreas Neumann a.neumann at carto.net
Tue Mar 3 11:37:44 PST 2009


Hi Matej,

QGIS does not yet have a field calculator or a similar mechanism. But 
since your data is in Postgis already, it is very easy to do it with 
Postgis and SQL:

UPDATE yourschema.yourtable SET LineLength = ST_Length(the_geom);

You can even set a row-level trigger so that the length gets 
automatically updated if a geometry changed. Please let me know if you 
are interested in the trigger thing.

Andreas

Matej wrote:
> Hello,
>  
> I have a PostGIS table which has an attribute "length". I would like 
> to have calculated length of every particular segment (the information 
> that is printed when I click on the Identify Features and then select 
> some line segment) to be somehow "set" into the field length 
> automatically. In MapInfo, this can be achieved by Update column and 
> then setting the ObjectLen to the appropriate field.
>  
> How can this be done in QGIS?
>  
> Thanks a lot!
>  
> Matej
> matej at matnet.net <mailto:matej at matnet.net>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>   




More information about the Qgis-user mailing list