5

In QGIS, how can I automate drawing a 100km x 100km square around a number of points, with the point being dead in the center?

I'd need to loop through all the points and create a polygon, but not sure what would be the automated way of doing so.


I was able to create buffers (circular) around the points, but now looking for a solution to convert those circles to squares -- something like the Envelope approach described here (but need it in QGIS): Creating square buffer around point feature using ArcGIS for Desktop?

  • 1
    what is the arrangement of points, are they in a square? – Willy Oct 4 '12 at 3:23
  • This depends strongly which area on the globe we are talking about. The polar and equatorial circumferences are different. And also: are your coordinates in degrees or cartesian? It should be fairly easy to calculate the bounding box with this information. – LarsVegas Oct 4 '12 at 9:52
  • The arrangement of points would be a square. 1km apart (or 500m apart). We're looking at North America only at this point, Canada specifically. – NikG Oct 4 '12 at 14:39
3

QGIS ships with OGR which has a method GetEnvelope():

# Returns the geometry's extent as a list (minx, maxx, miny, maxy)
<geom>.GetEnvelope()  

You can easily use it from within your QGIS python console. If you want to convert those coordinates into a shape? Have a look at my answer to this question for some info on modules which will help you turning this list into a vector file. There you find also further details and some helpful links.

  • Thanks LarsVegas! Can you script the entire process in QGIS (or outside of QGIS)? – NikG Oct 5 '12 at 21:54
2

You could use the mmqgis plugin for QGIS, which provides some more user-friendly implementations and interfaces of some QGIS functions. It adds an additional menu button next to "Web" and "Processing" from where you can choose "Create > Create Buffers" to get this interface: the mmqgis interface You get the option to choose in what units you want to measure the radius, how many edges you want - choose 4 for a square - and how the buffer should be rotated. At least in my case I also needed to rotate it by 45 degrees, otherwise it would have had kind of a rhombus-orientation. I did not try out the attribute option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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