Reputation: 49
Given some coordinates I'm trying to draw the external boundary of a polygon. But with the code that I attach you below:
from shapely.geometry import Polygon
lat_point_list = [42.108288,42.13397,42.087456,42.085308000000005,42.087456,42.13397,42.095806,
42.085308000000005,42.10305,42.108288,42.10305,42.095806]
lon_point_list = [14.272663, 14.218105, 14.185248999999999,14.213285999999998,14.185248999999999,
14.218105, 14.261092999999999, 14.213285999999998, 14.268307, 14.272663, 14.268307, 14.261092999999999]
polygon_geom = Polygon(zip(lon_point_list, lat_point_list))
polygon_geom
I Obtain:
How could I get only the external boundary, without the crossed lines within the boundary?
Upvotes: 0
Views: 1039
Reputation: 3437
You need to decide whether your points are ordered or it is a point cloud.
In the first case you need to ensure that each segment doesn't cross any other segment. Otherwise, the points are not in order.
In the second case you only have an unordered set of points or point cloud and you may be interested in finding its convex hull, where not all points will (in general) be part of the polygon.
Upvotes: 1