Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a data table mapped and the table also contains further information of interest, beyond the lat/long of the specific data points.

  1. I want to be able to draw a polygon and then simply have a count of records included in the area and also the sum of one of the other columns. This is likely a trivial task, but I'm very new with little time for this project.
  2. if get the above figure out, what is the best way to save a 'scenario' (the polygon area drawn and the results) so that I can experiment with differ scenarios?
share|improve this question
    
It's not clear yet what you are trying to achieve. A sketch would help. Upload it somewhere and post the link here (as long as you don't have enough reputation to post pictures). Do you want to calculate a convex hull? Or do you want to draw the polygons in 1. by hand? You'll find "Point in Polygon" count tool in the Vector menu. –  underdark Dec 17 '12 at 7:35

1 Answer 1

In PostGIS you should have two tables and one view. Points table has all points and their data, polygon table you have id and polygon and for view definition you have

CREATE OR REPLAVE VIEW data_in_polygon AS 
SELECT poly.id as poid, p.id as pid , p.attributes ... FROM polygon as poly , points as p 
WHERE ST_Intersect(poly,the_geom, p.the_geom) IS TRUE

that gives you view which has all points that intersect you polygon

SELECT poid, sum(dp.attribute) FROM data_in_polygon as dp GROUP BY poid 

Gives you SUM for an attribute in data_in_polygon view. You can also do it in one query.

Now in QGIS you add PostGIS polygon layer to your project , then toggle "Edit layer" draw some polygons and save changes. Now you can select wanted data from view...

edit: And i just noticed that you have polygon not postgis tag. Well there is no reason why you dont to use PostGIS

QGIS way is load polygons and point shapefile (or create them) user "Vector" -> "Data Management Tools" -> "join attributes by location" -> Select layers and go.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.