Wiki Markup |
---|
h2. Name
*sflayer* --\- Manage Simple Features Layer
h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#ffffaa}
*sflayer getextent*
*sflayer topostscript*
*sflayer towkt* _fid_
*sflayer tokml* _fid_
*sflayer getfids*
*sflayer getfieldnames*
*sflayer getfield*
*sflayer *{_}fid fieldname_
*sflayer* *setfield* _fid fieldname value_
*sflayer setspatialfilterrect* \[_minx miny maxx maxy\]_
*sflayer setattributefilter *_\[filter expression\]_
*sflayer resetreading*
*sflayer getnextfid*
*sflayer isvalid* _fid_
*sflayer issimple* _fid_
*sflayer isring* _fid_
*sflayer isnull* _fid_
*sflayer getgeometryname* _fid_
*sflayer getdimension* _fid_
*sflayer getenvelope* _fid_
*sflayer* *area* _fid_
*sflayer* *segmentize* _fid length_
*sflayer* *deletefeature* _fid_
*sflayer{*}_ _{*}createfield* _name type_
{panel}
h2. Description
Programmatically manage a project object of type *Simple Features Layer.* The datasource must be the active project object, set using *project activate* or *project setpath*
h2. Arguments
*getextent*
{indent} Return layer extent as a Tcl list \{ minx miny maxx maxy \}
{indent}
*topostscript*
{indent}
Return the geometry of the layer as a sequence of Postscipt drawing commands. This will preserver inner polygons and polygon winding. Points are not supported.
{indent}
*towkt* _fid_
{indent}Return the geometry of the given feature as well-known text. The fid argument is feature-id.{indent}
{color:#333333}{*}tokml{*}{color}{color:#333333} {color}{color:#333333}{_}fid{_}{color}
{indent}Return the geometry of the given feature as KML. The fid argument is feature-id.{indent}
{color:#333333}{*}getfids{*}{color}
{indent} Return the ids of all features in the layer as a Tcl list. If the spatial or attribute filters are set the feature set will be filtered accordingly.
{indent}
*getfieldnames*
{indent}Return all column (field) names in the layer as a Tcl list.{indent}
{color:#333333}{*}getfield{*}{color} {color:#333333}{_}fid{_}{color} {color:#333333}{*}{_}fieldname{_}{*}{color}
{indent}Return value of given field in the feature identified by feature id fid.{indent}
{color:#333333}{*}setfield *{color}{color:#333333}{_}fid _{color}{color:#333333}{*}{_}fieldname value{_}{*}{color}
{indent}Set field value in column (field) given by fieldname in feature identified by given feature id fid.{indent}
*sflayer setspatialfilterrect *\[_minx miny maxx maxy\]_
{indent}Set spatial filter to given rectangle. Subsequent calls to getfids, resetreading, and getnextfid will only return features that geometrically intersect with the given rectangle. If the rectangle coordinates are omitted the spatial filter is reset.
{indent}
{color:#333333}{*}sflayer setattributefilter{*}{color}{color:#333333} {color}{color:#333333}_\[filter expression\]_{color}
{indent}
Filter features by expression. Subsequent calls to getfids, resetreading, and getnextfid will only return features that pass the filter expression. The expression is a WHERE expression similar to what is used in SQL. For example, if the layer contain columns 'state' and 'area' the expression
state = 'ohio' and area > 1000
would set the filter to return only features that pass the given criteria. Valid operators are =, <>, <, >, <=, >=, LIKE, and IN.
Use the LIKE operator to perform wildcard comparison. Use % (any character) and _ (one character) as wildcard placeholders. For example, the following expression will filter all features with values in the name column that has 'OR' as the second and third letter, while allowing any set of characters after that:
name LIKE '_OR%'
This could return PORTUGAL, NORWAY, MOROCCO, etc.
To reset the attribute filter omit the filter expression.
{indent}
{color:#333333}{*}sflayer resetreading{*}{color}
{indent}
Reset the feature cursor used for reading feature ids. The next call to getnextfid will return the id of the first feature id in the layer. Note that spatial filtering and attribute filtering still applies.
To read all feature ids in the layer:
{noformat}
sflayer resetreading
set fid [sflayer getnextfid]
while { $fid != "" } {
puts "Feature id is $fid"
set fid [sflayer getnextfid]
}
{noformat}
{indent}
{color:#333333}{*}sflayer getnextfid{*}{color}
{indent}Return the next feature id and advance the feature cursor to the next feature ,as permitted by the spatial filtering and attribute filtering. See resetreading.{indent}
{color:#333333}{*}sflayer{*}{color} {color:#333333}{*}isvalid{*}{color} {color:#333333}{_}fid{_}{color}
{indent}Returns true only if the geometry of the feature with the given feature id is valid.{indent}
{color:#333333}{*}sflayer *{color}{color:#333333}{*}issimple *{color}{color:#333333}{_}fid{_}{color}
{indent}Returns true only if the geometry of the feature with the given feature id is simple according to OGC definitions.{indent}
{color:#333333}{*}sflayer *{color}{color:#333333}{*}isring *{color}{color:#333333}{_}fid{_}{color}
{indent}Returns true only if the geometry of the feature with the given feature id is a (closed ) ring.{indent}
{color:#333333}{*}sflayer *{color}{color:#333333}{*}isnull *{color}{color:#333333}{_}fid{_}{color}
{indent}Returns true only if the geometry of the feature with the given feature id is null.{indent}
{color:#333333}{*}sflayer getgeometryname{*}{color}{color:#333333}* *{color}{color:#333333}{_}fid{_}{color}
{indent}Return the geometry type of the given feature. The type corresponds to the type terminology used in well-known text representations, like POINT, POLYGON, etc.{indent}
{color:#333333}{*}sflayer getdimension{*}{color}{color:#333333}* *{color}{color:#333333}{_}fid{_}{color}
{indent}Return the dimension of the geometry of the given feature. The values are 0 for points, 1 for lines, and 2 for polygons.{indent}
{color:#333333}{*}sflayer getenvelope *{color}{color:#333333}{_}fid{_}{color}
{indent}Return the spatial envelope of the geometry of the given feature as a Tcl list : \{ xmin ymin xmax ymax \}.{indent}
{color:#333333}{*}sflayer area *{color}{color:#333333}{_}fid{_}{color}
{indent}Return the area of the given feature in the unit of the spatial reference.{indent}
{color:#333333}{*}sflayer segmentize *{color}{color:#333333}{_}fid length{_}{color}
{indent}Modify the geometry such it has no segment longer then the given distance.
{indent}
{color:#333333}{*}sflayer deletefeature *{color}{color:#333333}{_}fid{_}{color}
{indent}Delete the given feature{indent}
{color:#333333}{*}sflayer createfield *{color}{color:#333333}{_}fid name type{_}{color}
{indent}Create a new field in the layer. A field is similar to a column. The possible types are : integer, real, string, binary, date, time, datetime.{indent}
h2. See also
{pagebreak} |
Page Comparison
General
Content
Integrations