User Tools

Site Tools


spatial_analysis:feature_count

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
spatial_analysis:feature_count [2007/05/26 18:00]
127.0.0.1 external edit
spatial_analysis:feature_count [2018/08/04 00:01] (current)
Line 1: Line 1:
 +====== Feature count ======
 +
 +
 Suppose you have two vectors: one that contains points associated with surveyed sites, and another made of areas that represent fields or different regions of survey. You want to know how many sites are in each area and draw a map that brings this information. Suppose you have two vectors: one that contains points associated with surveyed sites, and another made of areas that represent fields or different regions of survey. You want to know how many sites are in each area and draw a map that brings this information.
  
 If your sites are classified into different types or classes (based on period or size), you might want also to know what distribution different classes have for each of your survey areas. If your sites are classified into different types or classes (based on period or size), you might want also to know what distribution different classes have for each of your survey areas.
 +
 +===== With GRASS =====
 +
  
 This is a shell script for **GRASS** that calls ''​v.what.vect''​ to know which points fall This is a shell script for **GRASS** that calls ''​v.what.vect''​ to know which points fall
Line 132: Line 138:
  
 {{spatial_analysis:​countpoints-bars.jpg?​300|Barcharts with d.vect.chart based on the output of the script}} {{spatial_analysis:​countpoints-pies.jpg?​300|Piecharts with d.vect.chart based on the output of the script}} {{spatial_analysis:​countpoints-bars.jpg?​300|Barcharts with d.vect.chart based on the output of the script}} {{spatial_analysis:​countpoints-pies.jpg?​300|Piecharts with d.vect.chart based on the output of the script}}
 +
 +===== With PostGIS =====
 +
 +Flavio Rigolon [[http://​www.faunalia.com/​pipermail/​gfoss/​2007-August/​005360.html|suggested]] this approach using [[http://​www.postgis.org|PostGIS]]:​
 +
 +<code mysql>​dbname => CREATE TABLE new_table AS SELECT grid.cat, COUNT(id) AS count FROM points,grid WHERE points.the_geom && grid.the_geom AND CONTAINS (grid.the_geom,​points.the_geom) GROUP BY grid.cat;</​code>​
 +
 +You should obtain a table. You can then JOIN ''​new_table''​ to your ''​grid''​ table using the ''​cat''​ column.
 +
spatial_analysis/feature_count.txt ยท Last modified: 2018/08/04 00:01 (external edit)