Methods for calculating area representations from a collection of infrastructure elements. These elements need to be point collections with geographic properties.
LocationArea( point_collection="sites", date=None, method="voronois", envelope_table="geography.admin0", radius=35, dem="elevation.nasa_srtm1", band=1, location_identifier="id", geometry_identifier="geom_point", above_ground_position=0, )
Class for generating a location area. This class is designed for generating surface area representation for a given point collection. Areas can be circles (generated from a given radius), Voronoi polygons, or a combination of those. Other more advanced methods will be implemented in the future. This class implements the Viewshed algorithm as proposed by Franklin, W.R., C.K. Ray, and S. Mehta, 1994. "Geometric Algorithms for Siting of Air Defense Missile Batteries", Technical Report DAAL03-86-D-0001, Battelle, Columbus Division, Columbus, Ohio, 129 p.
A point collection with longitude and latitudes. This parameter can fetch a table in the database (if a str is passed) or a list collection of tuples.
Location identifier from the point table to use. This identifier must be unique to each location.
Geometry column to use in computations. If calling a table from the database the column must have type
If using infrastructure.* tables (
cells) then a date is needed to determine which version of locations to use (because infrastructure elements may change locations). If no date is provided, the current date is used.
Method to use to compute polygons. The method can be one of the following: * 'voronois': Computes a Voronoi tessellation. * 'radius-voronois': Calculates a Voronoi tessellation that is clipped based on a generated circle. * 'radius': Generates a circle based on a given input radius. * 'viewshed': Computes viewshed polygons from point collection. * 'radio-propagation': Computes radio propagation polygons from point collection (not implemented).
Radius of buffer area around circle to generate in Km. Default value is 35km.
Table to use for keeping all geometries within a certain envelope. This is generally used to keep generated polygons within the boundaries of a region or country. Default is
geography.admin0. The table must contain a PostGIS
Digital elevation model table. The default table is
Band number identifier used to fetch data from the DEM. The default is
1for this parameter, and rarely changes.
Position above ground in which the observer is placed. This position is used to place the observer above the elevation of its position. It is common that transmitters are placed on towers. This parameter indicates the height of the transmitters. It should match the unit of the DEM dataset provided in
Short-hand method for calculating the area of each LocationArea() representation computed. This method uses the projection from Flowdb (WGS84 by default). This could compute incorrect distances depending on the scenario.
pandas.DataFrame containing areas in Km.
True is caching is switched on.
Returns the column names.
List of the column names of this query.
Get the column names as a comma separated list
Comma separated list of column names
The set of queries which this one is directly dependent on.
Returns a unique fully qualified name for the query to be stored as under the cache schema, based on a hash of the parameters, class, and subqueries.
String form of the table's fqn
A list of columns to use as indexes when storing this query.
By default, returns the location columns if they are present and self.spatial_unit is defined, and the subscriber column.
daily_location("2016-01-01").index_cols [['name'], '"subscriber"']
True if the table is stored, and False otherwise.
Generate a uniquely identifying hash of this query, based on the parameters of it and the subqueries it is composed of.
query_id hash string
Return the current query state.
The current query state
Return the current query state as a string
The current query state. The possible values are the ones defined in
Returns a uniquename for the query to be stored as, based on a hash of the parameters, class, and subqueries.
String form of the table's fqn