OS Python week 3: Filters & analysis; Functions & modules
Filters & Simple Analysis of
Vector Data; Functions &
Modules
Open Source RS/GIS Python
Week 3
OS Python week 3: Filters & analysis; Functions & modules [1]
Attribute filters
? The Layer object has a method
SetAttributeFilter()
? Resets reading so GetNextFeature()
gets the first feature that matches the filter
? Pass None to clear the filter
>>>
42
>>>
>>>
6
>>>
>>>
42
layer.GetFeatureCount()
layer.SetAttributeFilter("cover = 'shrubs'")
layer.GetFeatureCount()
layer.SetAttributeFilter(None)
layer.GetFeatureCount()
OS Python week 3: Filters & analysis; Functions & modules [2]
Spatial filters
? There are two methods on the Layer
object to set spatial filters
? SetSpatialFilter()
? SetSpatialFilterRect(, ,
, )
? Use SetSpatialFilter(None) to clear the
filter
OS Python week 3: Filters & analysis; Functions & modules [3]
layerAreas is polygon and layerSites is points
>>> featAreas = layerAreas.GetNextFeature()
>>> poly = featAreas.GetGeometryRef()
>>> layerSites.GetFeatureCount()
42
>>> layerSites.SetSpatialFilter(poly)
>>> layerSites.GetFeatureCount()
3
>>> layerSites.SetSpatialFilterRect(460000,
4590000, 490000, 4600000)
>>> layerSites.GetFeatureCount()
4
>>> layerSites.SetSpatialFilter(None)
>>> layerSites.GetFeatureCount()
42
OS Python week 3: Filters & analysis; Functions & modules [4]
More complicated filters
? DataSource objects have a method
ExecuteSQL()
? Returns a Layer object that can be looped
through like other layers
? When done with the resulting layer, call
ReleaseResultSet() on
the DataSource
? See
for more info about valid SQL syntax
OS Python week 3: Filters & analysis; Functions & modules [5]
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 1 functions in python
- introduction to rf filter design rowan university
- intermediate python read the docs
- lecture 4 smoothing
- pandas cheat sheet python data analysis library
- list comprehensions
- influxdb python read the docs
- os python week 3 filters analysis functions modules
- cookbook filter guide welcome to the cookbook filter guide
- introduction to digital filters
Related searches
- python modules list
- python modules download
- python 3 functions list
- how to add modules in python calculator
- python 3 functions pdf
- python download 3 8 6
- espn nfl week 3 predictions
- anaconda python version 3 6 download
- 3 09 exponential functions practice test
- math functions python 3 8
- pillow image filters python examples
- python documentation 3 9