Given a point layer in QGIS 3.03, I am attempting to create a second layer of square polygons with a specified length of x kilometers whose centers are the points in the first layer. What would be the best way of accomplishing this?

  • If Qgis is not the only option for your job, then you can use CSV2Shape function which uses js2shape.js and geographiclib.js for creating rectangle with specified length and breadth in meters. geospatialearth.in/Point2Poly – GeoSpatialEarth.in Jun 26 '18 at 18:58
  • 1
    one of a few solutions using pyQGIS? – geozelot Jun 26 '18 at 20:20

In QGIS 3 (I’m using 3.2.0 Bonn) you can simply use the default QGIS buffer algorithm, select your points, chose the buffer distance and select End cap style = square.

See https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#buffer for more information.

The v.buffer algorithm from GRASS GIS offers the same option and can also be used in older versions of QGIS. See https://grass.osgeo.org/grass75/manuals/v.buffer.html for more Information.

| improve this answer | |

You should be able to use the Virtual Layer (or DB Manager) and create squares of a given 'inner radius' with ST_Expand (SpatiaLite):

SELECT <id_or_attribute_1> AS <name>,
       ST_Expand(geometry, <X / 2 * 1000>) AS geometry
FROM <your_layer>;

This will expand the BBOX in each direction by the given value in units of the data's CRS.

Note: this, as many other solutions, only makes sense if the data is in a metric map projection; best find an equal area projection for your region of interest and reproject either on the fly with ST_Transform or in advance.

| improve this answer | |

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.