Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »

Name

sflayer --- Manage Simple Features Layer

Syntax

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

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

Arguments

getextent

Unknown macro: {indent}

Return layer extent as a Tcl list { minx miny maxx maxy }

topostscript

Unknown macro: {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.

towkt fid

Unknown macro: {indent}

Return the geometry of the given feature as well-known text. The fid argument is feature-id.

tokml fid

Unknown macro: {indent}

Return the geometry of the given feature as KML. The fid argument is feature-id.

getfids

Unknown macro: {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. 


getfieldnames

Unknown macro: {indent}

Return all column (field) names in the layer as a Tcl list.

getfield fid fieldname

Unknown macro: {indent}

Return value of given field in the feature identified by feature id fid.

setfield fid fieldname value

Unknown macro: {indent}

Set field value in column (field) given by fieldname in feature identified by given feature id fid.

sflayer setspatialfilterrect [minx miny maxx maxy]

Unknown macro: {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.

sflayer setattributefilter [filter expression]

Unknown macro: {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.

sflayer resetreading

Unknown macro: {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:

sflayer resetreading
set fid [sflayer getnextfid]
while { $fid != "" } {
 puts "Feature id is $fid"
 set fid [sflayer getnextfid]
}

 

 

sflayer getnextfid

Unknown macro: {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.

See also

  • No labels