vec:Transform process operates on a feature collection using a series of expressions. This process is equivalent to the
SELECT ... FROM clause in SQL, allowing you to define a new feature collection with attributes computed from some, or all, of the input feature collection. The new attributes are computed via ECQL expressions which can process geometry as well as scalar data.
transform string is a sequence of specifiers in the form
name attribute is the name of an attribute used in the output feature collection, and
expression is an ECQL expression using the input attributes and constants.
Inputs and outputs¶
||Input feature collection||SimpleFeatureCollection||Required|
||Transform specification—List of specifiers (
The following examples illustrate how to use the
vec:Transform process. All of the examples use the
medford:bikelanes feature collection, with different expressions for the
- A new feature collection with a single attribute containing the name of the street each bike lane is on:
- Same as example 1 only renaming the attribute name to
- Same as example 1 only adding in the length of the feature:
the_geom=the_geom; street_name=streetname; length = length(the_geom)
- Same as example 1 only adding an attribute called
difcontaining the difference between the computed length and the value in the
lenattribute of the original input layer:
the_geom=the_geom; street_name=streetname; length = length(the_geom); dif=length(the_geom)-len
- A new feature collection containing the x and y coordinates of both the start and end points of the bike lane, in addition to an attribute with the name of the street each bike lane is on:
the_geom=the_geom; x1=getX(startPoint(the_geom)); y1=getY(startPoint(the_geom)); x2=getX(endPoint(the_geom)); y2=getY(endPoint(the_geom)); streetname=streetname
- Using the resulting feature collection from example 5 as input instead of
medford:bikelanes, this example will replace the original geometry by a straight line between the start and end points, and add an attribute for the street name.
the_geom=geomFromWKT(Concatenate('LINESTRING(' ,x1, ' ', y1, ', ', x2, ' ', y2,')')); streetname=streetname