The following explains (1.) how to construct technically a polygon from points and (2.) different methods to construct a polygon from points.
1. Tool to create a polygon from point coordinates
I would use the GDAL Python bindings to do that.
To give you a starting point have a look at the following script:
from osgeo import ogr
# you have a list of points
listPoint = [[13.415449261665342, 52.502674590782519],[13.416039347648621, 52.50250152147968],[13.415787220001221, 52.501845158120446],[13.416162729263306, 52.502201097675766],[13.415406346321104, 52.502334982450677],[13.415111303329468,52.50204435400651]]
# Add the points to the ring
ring = ogr.Geometry(ogr.wkbLinearRing)
for point in listPoint:
lat = point[0]
lon = point[1]
print lat, lon
ring.AddPoint(lat,lon)
# Add first point again to ring to close polygon
ring.AddPoint(listPoint[0][0], listPoint[0][3])
# Add the ring to the polygon
poly = ogr.Geometry(ogr.wkbPolygon)
poly.AddGeometry(ring)
print poly.ExportToJson()
2. Methods to create a polygon from point coordinates
There are two problems to think about when creating a polygon from points.
- The order of the points
- Points that might be contained by the polygon
Two methods to approach this problem:
Convex Hull: It is the smallest convex set containing all points. You can see it as a rubber band wrapped around the “outside” points.
Delaunay triangulation: All points are connected to each other.