[Qgis-user] adding points within polygons
Brent Wood
pcreso at yahoo.com
Mon Feb 8 11:59:22 PST 2016
Which version of QGIS are you using? This is in the dev version which I'm using (on Linux), but not in QGIS 2.8 (just looked at that on another laptop - Geometry tools is there - but not the centroid one). I don't know if it is in 2.12 or not.
You can also install the "realcentroids" plugin. This seems to create a replica of the polygon table, but creates a point feature to replace the polygon, which should also do what you want.
I just tried it & it worked in a simple test case. Perhaps your easiest option.
There is also a processing -> qgis geoalgorithms -> polygon centroid function, but this can return a point which does not lie within the polygon if the polygon is concave.
A bit more cumbersome - but you can also:
edit the polygon layer,
open the attribute table
start the field calculatorcreate a new (real no with decimals) column as the X value ie: X($geometry)
create a new column as the Y value ie: Y($geometry)save as CSV file
open the CSV file & define it as a point layer using the new X & Y columns for coords
You now have a point layer of centroids (but note that centroids can lie outside a concave polygon):-)
Cheers
Brent
From: rsweeny <rsweeny at mun.ca>
To: Brent Wood <pcreso at yahoo.com>; "qgis-user at lists.osgeo.org" <qgis-user at lists.osgeo.org>
Sent: Tuesday, February 9, 2016 7:54 AM
Subject: Re: [Qgis-user] adding points within polygons
Brent
So kind of you to respond. I am afraid "geometry tools" is not an option on my Vector pull down menu or toolbar. Do I need a plug-in?
I quite agree with you about the centrality of a proper relational database underpinning the gis. It is getting from one to the other that is giving me the headaches.
Robert
On 08/02/2016 7:01 PM, Brent Wood wrote:
Hi Robert,
You can create a layer of points for each polygon using:Vector - Geometry Tools - Polygon Centroids
if you have a common field in this and the census data, you can then join the two: Layer - Properties - Join
But I recommend the use of an underlying database tool to manage your data, such as Postgis or Spatiallite, and join the data there to be used in QGIS. A collection of files does not provide the power of a database for managing data, even when accessed by QGIS.
Well managed data is the foundation your analysis, model or GIS sits on...
Cheers
Brent Wood
From: rsweeny <rsweeny at mun.ca>
To: qgis-user at lists.osgeo.org
Sent: Tuesday, February 9, 2016 2:10 AM
Subject: [Qgis-user] adding points within polygons
Hi
People's answers to Grant's question were so clear I'm hoping that
something similar might exist to facilitate my task. I have 32k of
polygons representing every lot in the city of Montreal in 1903. I also
have the 1901 census returns coded by household (95k of them) to those
lots. Is there a simple way to have Qgis place points within each lot
polygon for the corresponding households?
Thanks in advance.
Robert
--
Robert C.H. Sweeny
Professor of History
Memorial University of Newfoundland
St John's NL, A1C 5S7
Canada
709-864-8440, 709-864-2164 (fax)
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
--
Robert C.H. Sweeny
Professor of History
Memorial University of Newfoundland
St John's NL, A1C 5S7
Canada
709-864-8440, 709-864-2164 (fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160208/b73e06cc/attachment.html>
More information about the Qgis-user
mailing list