Sunday 19 February 2017

qgis - Is it possible to create a point within a Polygon (not a centroid)?


Is it possible (without writing Python code - sorry I'm not a developer) to create a point layer from a polygon layer but ensure the point is within the polygon? The ftools centroid tool is cool but some centroids are created outside the polygon (i.e. irregular polygon). In ArcGIS there is a "Feature to Point" tool similar to the ftools 'polygon centroids' tool but has a checkbox to force the point to be within the polygon.



Answer



If you do not care about whether the point is a centroid or not, just use Vector -> ResearchTools -> Random Points. You may define to place a single point per each polygon in a layer. Also you may create centroids for initial polygons, delete points that do not intersect any polygon, save polygons without points as a separate layer, create random points for this polygosns and in the end copy these random points to centroids layer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...