OSM usually doesn't contain the exact outline of a junction or intersection (except in very few cases where area:highway has been mapped) and most roads don't have a width set.
However you can try to estimate it by looking at the highway class (i.e. primary, secondary, tertiary...) and the number of lanes.
To my knowledge this requires multiple steps.
Note: This will give wrong results if you have overlapping polygons on one of your layers already.
Merge vector layers and select all the layers in question. This gives you one single layer to continue with. Also it adds a layer and path attribute to each feature to keep track of their provenience.
Union with ...
I found a solution thanks to osgeo library that allows to interact with the single parts of a multipolygon geometry.
Help me the answer of Barret in this topic.
from osgeo import ogr
for feature in prv2.getFeatures():
g = feature.geometry()
g1wkt = ogr.CreateGeometryFromWkt(g.asWkt())
g2wkt = ogr.CreateGeometryFromWkt(...
From what I understand, your table uf has the geom of the federal units and municipios the geom of the municipalities, and you don't hvae any problem with the polygons (usually when you do this kind of things, the geom are not perfectly similar and there is approximation that make the correspondance between 2 tables difficult, but here I assume they come ...
Or if you are happy with just plane trig solution in just 19 lines of code. Here it is in U-Basic.
This differs from the algorithms for geodesics solution by about 6mm at a distance of 175 meters.
5 'interx.ub adapted from code at
7 'In U Basic by yuji ...