I'm trying to geo-process some data in a .shp
, using Geopandas.
I would like to find a point in a geometry edge, given a bearing and an initial point inside of it.
How can I do this in an optimized way, since the algorithm will process a lot of iterations (approx.: ten per point)?
It depends on whether you want to stick to lon/lat or you can switch to projected coordinate system like
UTM
; and also what exactly you mean bybearing
. One possible way assuming projected coordinates andcompass bearing
(clock-wise degree from north: 0-360) is to draw a line in the direction of your bearing which is long enough to intersect with the Polygon and compute the coordinate of the intersection.let's say we have a GeoDataFrame containing a Polygon of a district in Berlin:
compute the x/y of the centroid of the geometry(can be any point, here I use centroid for representing the idea):
Following function can compute coordinates of the new point:
try it with our input data: