# Creating polygons with fixed extent based on point which represents S/W corner using QGIS

In QGIS, use "Geometry by Expression" tool (in a projected CRS). It will also add points information/attributes to polygons.

Select "Polygon" as "Output geometry type" option.

Add the following expression as "Geometry expression" value:

`make_square(make_point($x, $y), make_point($x+100, $y+100))`

Using a Virtual layer, you can create a polygon of the desired dimension and move it to each location of the point layer. You can then `save as`

the output if you want to persist the data.

Go to the menu `Layer > Add Layer > Add/Edit Virtual Layer...`

and enter the following query. Replace the layer name for yours.

```
WITH src AS (
SELECT ST_GeomFromText('POLYGON((0 0, 100 0, 100 100, 0 100, 0 0))') AS geometry
)
SELECT ID, ST_Translate(src.geometry, st_x(pt.geometry), st_y(pt.geometry),0) as geometry
FROM "myPointLayer" pt, src
```

For each point (x,y) in a projected CRS generate a string like:

```
polygon((x y, x+100, y, x+100, y+100, x y+100, x y))
```

you can then process that into a `Polygon`

using `geom_from_wkt`

.

Then save the layer as a shapefile (or better still a GeoPackage).