GME

Geospatial Modelling Environment

addxy (Add XY Coordinates To Table)

Adds new x and y coordinate fields to a feature data source table (points, lines, polygons)

Description

This command adds new x and y coordinate fields to a feature data source table. The coordinates added to the table depend on the type of input feature (points, lines or polygons) and the options specified by the user.

For points the user specifies the input data source, and optionally a prefix that is used to name the fields (default field names are X and Y, and if a prefix is specified then X and Y are added to the prefix). There are no options for point data sources (the simplest case).

If the input is a polygon dataset the user can specify the 'env' option, and/or the 'centroid' option, and/or the 'label' option. The 'env' option adds a series of fields (see below) based on the rectangular envelope that contains the polygon. Note that in the case of multipart features (polygons consisting of multiple parts that may be disjoint in space) then the envelope will be the rectangle that contains all of the parts. The centroid option add the point that is the centre of gravity of the shape (although the algorithm used to publish this is not clear, so this statement should not be taken too literally). The centre of gravity of the shape is not guaranteed to fall inside the bounds of the polygon, and in the case of multipart features is unlikely to do so. The 'label' option adds the coordinates of what ESRI defines a label point: a point that is guaranteed to fall inside the polygon somewhere. The algorithm used to make this calculation is not published so it is not clear how this location is determined.

If the input is a line (polyline) dataset the user can specify the 'env' and/or 'ends' options. The 'env' option is described in the previous paragraph. The 'ends' option adds the coordinates of the start and end points of the line.

Note that the default field names (see below) have been devised so that if you specify multiple options (e.g. the centroid and label options in the case of a polygon data source) then there is no naming conflict, even when a prefix is specified.

In all cases, if a prefix is specified the prefix will precede all the default field names described below. Prefix names should not contain special characters and should be short (6 characters or less - longer prefix names will raise an error).

Note that if the fields specified already exist then the values in those fields are overwritten.

See also: field.delete

Syntax

addxy(in, [env], [centroid], [label], [ends], [prefix]);

inthe input feature data source
[env](TRUE/FALSE) (applies to lines and polygons only) adds the min x, max x, min y, max y, center x, center y of the rectangular envelope bounding the feature (default=FALSE)
[centroid](TRUE/FALSE) (applies to polygons only) adds the coordinates of the centroid of the polygon (default=FALSE)
[label](TRUE/FALSE) (applies to polygons only) adds the coordinates of the label point of the polygon (default=TRUE)
[ends](TRUE/FALSE) (applies to lines only) adds the coordinates of the start and end points of the line (default=TRUE)
[prefix]the prefix to be applied to the default field names (should not exceed 6 characters - see help for further details)

Example

(points): addxy(in="C:\data\wellsites.shp", prefix="COORD");

(polygons): addxy(in="C:\data\myGDB!parcels", env=TRUE, label=TRUE);

(lines): addxy(in="C:\data\roads.shp", env=TRUE, ends=TRUE);


Messages

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

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

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