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 plotted 30,000+ points in QGIS by postcode, various data items for each. How do I resize these plots based on the activity at each of these points i.e. small dot for <100, larger dot for 100-200 and larger dot for 200+?

share|improve this question
1  
Is 'activity' a field in the attributes of your point dataset? –  Simbamangu May 4 '12 at 11:39
    
No. I am aware I can load in aggregates for each postcode but I will be loosing all my data items. –  BNA May 4 '12 at 11:58
3  
Difficult to understand what you're trying to do ... could you post a link to example data? –  Simbamangu May 4 '12 at 12:03
    
ecologyandsociety.org/vol7/iss3/art7/figure5.gif different dot sizes for different levels of activity –  BNA May 4 '12 at 13:34
1  
the value for each of the 30,000+ points is 1. i understand i could load the data already aggregated and this would not be an issue but this is not what i am looking for. i work in health and for example we have 2 areas where i have loaded 25 lines of data, the total activity in one is 10 and the other is 15 so one dot larger than the other. –  BNA May 4 '12 at 15:07

2 Answers 2

If you only have a few categories you want to map, then the rule-based rendering (Style tab under Properties) can give you different symbols based on values of an attribute.

You'll want to make three rules, each of which has a different symbol size and a rule for how to classify it. For example, in the Rule Properties dialog:

  • Name: Small
  • Symbol: size 1 mm
  • Filter: activity < 101

Then for the next category:

  • Name: Medium
  • Symbol: size 3 mm
  • Filter: activity >= 101 AND activity <201

... and so on for other categories.

Proportional symbols are something I really miss as an automatic function in QGIS - it's probably the only function that ArcGIS has that I really need anymore.

Update I assume you have a spatial point file with one point for each of PC1, PC2, etc? Given the data in your comment:

PATIENT, LOCATOR, DISEASE, ADMISSION TYPE 
1, PC1, HEART DISEASE, EMERGENCY 
2, PC1, HEART DISEASE, ROUTINE 
3, PC1, HEART DISEASE, EMERGENCY 
4, PC1, HEART DISEASE, EMERGENCY 
5, PC1, HEART DISEASE, ROUTINE 
6, PC1, HEART DISEASE, EMERGENCY 
7, PC1, CANCER, ROUTINE 
8, PC2, CANCER, ROUTINE 
9, PC2, CANCER, EMERGENCY 
10, PC2, CANCER, ROUTINE

You will need to summarise the number of rows where each locator appears and join it to your point shapefile.

While this is an ideal situation to use a database (sqlite, postgis, mysql), here's a way to do it with tools you'll have (or can get easily):

  1. Open your data file in Excel or Openoffice. You should have columns for 'Patient', 'Locator', etc.
  2. Do a Pivottable of the data, and select your entire data file as the source table.
    • Data|Pivottable|Create ... in Open or Libreoffice;
    • Data|Pivottable in Excel
  3. Drag the 'Locator' field into the ROW FIELDS section.
  4. Drag the 'Locator' field into the DATA FIELDS section, then double-click on it and select "COUNT" as the summary type.
  5. Click 'ok' and you will have a new table with Locator and the number of each Locator that was found. Save this table as a .CSV file - easiest is probably to copy just the headings and rows of the pivottable and paste into a new sheet. Rename 'count of Locator' as Activity.
  6. Add this CSV file to QGIS - not using 'delimited text', just add a vector layer and select CSV as the type.
  7. Add the points shapefile and open Properties.
  8. Select the Join tab, and click the + to add a new join.
    • For 'Join Layer' select the CSV file name;
    • For 'Join field' select Locator
    • For 'Target field' select Locator, or whatever name you used in the shapefile.
    • Click OK then close the Properties.

You will now have a new column in your point shapefile called 'Activity' which you can use to create different symbol sizes, as above.

Note: if you're doing this a lot, it's definitely worth developing a database to store both your activity data and point file!

Update the second (and last) ... using sqlite

I find the spatialite-gui application the easiest and often quickest way to deal with spatialite dbs - it does all the spatial refs / geometry columns by default and it's easy to import shapefiles and other tables. In spatialite-gui, create your example.sqlite and:

  1. Import your points shapefile;
  2. Import the csv with the activity data.

In QGIS, I like to use the DB Manager plugin to run SQL commands (you'll need to install it). After you've added the example.sqlite points layer, you'll have access to the .sqlite database in the plugin. Open it, then select the example.sqlite db in the tree and click 'SQL window'. You can use something like:

SELECT * from bna_pts 
INNER JOIN (SELECT Loc, COUNT(*) as Activity FROM bna_acts GROUP BY Loc) 
WHERE Loc=bna_pts.Loc

Where: bna_pts is your imported shapefile and bna_acts is the activity CSV, and 'Loc' is the locator name. Execute it, select 'load as new layer', give it a name, and you have the points file with 'Activity' as the total number of activities at each point.

You can set this up far more automatically - read up on sqlite!

share|improve this answer
    
this sounds extremely time consuming. how does using a database help? i have converted the data into .sqlite but don't see how this helps. –  BNA May 10 '12 at 14:40
    
It should take you five-ten minutes or so to do the whole process! Have you tried it? –  Simbamangu May 10 '12 at 16:17
    
your first answer would be time consuming for my original dataset of 30,000+ where I would have to do this for each hospital, specialty etc etc. I will read up on sqlite...thanks for your help. –  BNA May 11 '12 at 7:31

As far as I know, this is not supported by default.

The feature that comes closest is the "Point Displacement Renderer". With some modifications, it should be possible to to change it to your desired behavior.

share|improve this answer
    
Where would I find this? –  BNA May 4 '12 at 13:35
    
"Displacement plugin" should be shipped with QGIS 1.7.x. Maybe it has to be activated first. It adds a new renderer option to style tab. It's a C++ plugin. svn.osgeo.org/qgis/trunk/qgis/src/plugins/… –  underdark May 4 '12 at 17:26

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.