Description Usage Arguments Value Note Examples
This function creates a table with polygone geometries of a Voronoi tessellation in a Postgres database.
1 | createVoronoi(tableName, the_geom, ogc_fid, scale)
|
tableName |
The name of existing table within the Postgres database. |
the_geom |
The column name with the geometries of the generating points. |
ogc_fid |
The column name with the unique identifiers for each row element (point). |
scale |
The percentage of buffer distance (how far the expand outward) |
The function returns the name of the voronoi table that has been created.
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. createVoronoi() function exploits this code, but a small modification was required. The buffer_distance has been made flexible in contrast to the original code that sets the buffer distance to 10 The r_voronoi(text,text,text) has been replaced by the r_voronoi_scale(text,text,text,float), and TYPE was renamed as the r_voronoi_scale_type. In the original code, search for the section with the comment "calculate an approprate buffer distance (~10 to make createVoronoi() to work as explained in the example.
1 2 | tableName<- all_coor_ws_2_pgdb(ghcnd='GHCND', geoid='40', type='TMAX', suffix='voronoi_example')
createVoronoi(tableName, the_geom = "geom", ogc_fid = "ogc_fid", scale = 0.25)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.