I have a point Shapefile with unsorted feature ID's (FID). I want to convert the same point file into polygon Shapefile by using python gdal/ogr. I got the help from link1 and link2. I'm able to make polygon shapefile successfully but because of my unsorted point Shapefile the output of polygon shapefile is irregular (not as expected). Expected polygon shapefile is ring/polygon/box around points .


.
Is there any way to sort point shapes as right to left or left to right before making polygon Shapefile?