Friday 11 September 2015
Aggregate Points inside a Polygon using Point in Polygon analysis tool in QGIS 2.8
Clustering or aggregating points can help the end user analyze data on the maps better. Most times, points or markers can be so many at several different locations within a map that aggregating them will bring about a saner look. In addition, applying a cluster will give the map user the number of points within a geographic extent or location.
Task
To aggregate our points as clusters with labels using Points in Polygon analysis tool in QGIS 2.8
Load your sample data into QGIS. The sample dataset comprises a Point features shapefile- and a polygon feature shapefile.
See the Layers window on the screenshot. Download the data from the link text above.
(kindly attribute the sample dataset to www.mapsnigeriainitiative.wordpress.com)
Click on Vector > Analysis Tools > Points in Polygon. This analysis tool will aggregate the points within their respective polygons.
The Count Points in Polygon window will open. Fill in the details as on the screenshot below and set a directory and name for the output shapefile. Click Ok when the processing is done.
Our new shapefile-PNTCNT is added to the Layer window. It is a polygon shapefile.
Right Click the new layer > Open attribute table. Note that the points have been aggregated and a count is given per polygon feature. See column PNTCNT on the table in the screenshot below.
Symbolize the point count as cluster markers and label them.
Right Click on the PNTCNT layer and click on Properties in the drop down menu.
First Click on Style (red boxed 1) and the style window will open. Choose Single Symbol (red boxed 2), then go to the Simple fill (red boxed 3) and click on it. To the extreme right, click on the dropdown box and select Centroid fill (red boxed 4).
The Centroid fill (red boxed leftmost) will move to a position above the marker. Edit the Colors option to a transparent fill and adjust the Size to 4.2 (see red boxed area to the right). Click Apply and transparent circle symbols should appear inside the polygon features. Click Ok.
Next we label the circle markers. Double click the layer and the Layer Properties window will open.
Click on Labels (red box 1) > Click on the Label this layer with and Select the PNTCNT field from the drop down menu. Go down and click on the Placement option(red boxed 3). Check Offset from centroid.
Then click on the Text option and change the Color to red. Click Apply to observe the changes on the map window and Click Ok to save them.
The symbols now have their labels showing the number of points in each polygon. The map user can now visualize the points based on their immediate geographic location depending on the scale we used for the map.
Now we have a map using symbols to illustrate the number of points in a particular polygon. Thank you for following us.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment