[R-sig-Geo] Reordering geographical coordinates clockwise to make a polygon

Patrick Giraudoux p@trick@gir@udoux @ending from univ-fcomte@fr
Mon Nov 5 14:02:05 CET 2018


Dear listers,

There is an interesting post here: 
https://stackoverflow.com/questions/6989100/sort-points-in-clockwise-order 
dealing on the issue. However, I would like to know if a function has 
been already developped in a R package.

I am coping with a young colleague's shapefile where borders of polygons 
have been drawn as lines quite inconsistently. To change this 
SpatialLinesDataFrame into a SpatialPoints object is easy. The idea is 
to  select the points  bordering each polygon (delete the others), 
define the point set as a Polygon, then rebuild step by step a 
SpatialPolygonsDataFrame with all its (~25) polygons. It would be much 
quicker than to redraw one by one the 5160 data points (two times on 
borders shared by two polygons).

The problem is that the points must be reordered clockwise (the way 
lines making the  borders is all except clockwise) before making them a 
polygon.

Any function already developped for that ?

Cheers,

Patrick




	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list