Description Usage Arguments Value Note Examples
The function takes the name of a existing table made of at least to columns: a column with geometric points and a column with unique identifiers for each element row in the table. The function produces a table in a Postgres database with geometries that form a Voronoi tessellation ( polygones ). The arguments needed for the function are two: a table's name and geoid number.
1 | canopiVoronoi(tableName, geoid)
|
tableName |
Table with geometric points used to generate Voronoi tessellation |
geoid |
The geoid is needed to identify the boundaries of intersection, where the generating points reside, that is in a State or a County. |
Function returns the name of the table containing the polygones forming the Voronoi or the value 1 when fail to find weather station information.
The output table name has the following form: st_co_geoid_ws_sufix_type_v_poly. "st" is the U.S. State name and "co" is the U.S. County name. The "sufix" and "type" are specified by the user in the all_coor_ws_2_pgdb function. The following function assumes you have postgresql-9.x/-10.x, postgis-2.x, and postgresql-9.x-plr extension installed. Enable your database with both postgis and plr extensions with the following command in UBUNTU: > sudo -u dbuser psql -c "CREATE EXTENSION postgis; CREATE EXTENSION plr; where dbuser is the owner of the database. Moreover, in https://gist.github.com/djq/4714788 you will find the query code to be loaded into the database. The r_voronoi(text,text,text) function is needed to create the Voronoi tessellation. canopiVoronoi() function exploits this code for my study, but a small modification was required. The buffer_distance has been increased from 10 When using the functions from this package to produce the table with the geometric points, as shown in the example, you should not have problems reusing canopiVoronoi().
1 2 3 4 5 6 | tableName <-all_coor_ws_2_pgdb( ghcnd = 'GHCND',
geoid = '12087',
type = 'PRCP',
suffix = 'example'
)
canopiVoronoi(tableName, geoid = '12087')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.