I want to create rectangular polygons from points. Actually I have a GeoPandas point DataFrame and the distance in X & Y direction to form the polygon. The distances are equal for every point. I know it is possible to use QGIS or ArcMap, but I look for a method in Python without using this software.
EDIT: it is not a duplicate as far as I can see because the other questions are looking for a square buffer I look for a rectangular buffer with a different size in x, y directions.
EDIT 2: Here is what I have so far
import shapely as spl
test_point = [(8.54253101348877, 49.53561782836914)]
distance_lon = 0.010373115539550781
distance_lat = 0.011997222900390625
spl_polygons = [spl.geometry.Polygon([(x - distance_lon, y - distance_lat), (x + distance_lon, y + distance_lat), (x - distance_lon, y + distance_lat), (x + distance_lon, y - distance_lat)]) for x,y in test_point]
The problem is the output looks like:
not like a rectangular polygon? What am I doing wrong?
Edit 3: The point which form the polygon have to be in the format of (lower left, lower right, upper right, upper left). Now I got the polygon in rectangular format.
Correction of last line:
spl_polygons = [spl.geometry.Polygon([(x - distance_lon, y - distance_lat), (x + distance_lon, y - distance_lat), (x + distance_lon, y + distance_lat), (x - distance_lon, y + distance_lat)]) for x,y in test_point]