Geospatial Modelling Environment

addlength (Add Length Field To Table)

Adds a new length field to a polyline data source


This command adds a new length field to a polyline data source. The tool can also perform on-the-fly unit conversion if the coordinate system of the data source is defined. The default is to write the length values in the coordinate system units (e.g. meters for UTM data). This default option does not require that a coordinate system is defined. The unit conversions available are between meters, kilometers, miles and feet.

It is not appropriate to use this tool with data in a geographic coordinate system (spherical coordinates require different algorithms to calculate distances and lengths). If the tool detects a geographic coordinate system it will raise an error and will not process the command. However, if the coordinate system is not defined the tool is unable to determine whether it is a geographic coordinate system or not, so will process the command even though it creates nonsensical results. It is highly recommended that you reproject your data if you wish to use any of these tools (none of them are designed to accommodate spherical coordinates).

Note that if the length field specified already exists then an error will be returned unless you have specified the update=TRUE option.

See also: field.delete


addlength(in, field, [units], [update], [where]);

inthe input line data source
fieldthe name of the length field to add or replace
[units]the length units (see help for details); the coordinate system must be defined to use this option (default=csu (coordinate system units); options: csu, m, km, mi, ft)
[update](TRUE/FALSE) if TRUE and you specify an existing field, the existing field will be updated rather than generating an error message (default=FALSE); warning: this option will result in overwriting of existing data and is therefore potentially dangerous.
[where]the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details)


addlength(in=”C:dataroads.shp”, field=”LTEST1″);

addlength(in=”C:dataroads.shp”, field=”LTEST2″, units=”km”, where=”COUNTY=’WOOD’ AND MONTH=7″, update=TRUE);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn