Hi, all,
Attached is a script for cleaning up coastline data extracted from GIS datasets. In this type of data I ran into some trouble with the ordering of the points. The data can jump from point A on the mainland to point B on a small island --- than circle around the island in a clockwise/counterclockwise direction --- than back from point B to a point C on mainland. Sometimes people clean up the connections between AB and BC by inserting NaN to tell the program here is an island. The big jump distances between AB and BC can be a feature to be detected:
Point A on Main Island
NaN;
Point B on small island
(Coordinates of the small island)
Point B;
NaN;
Point C on Main Island
But after cleaning up, A and C will not longer be connected! Another problem is that, in my case, some "jumps" can be as short as a few hundred meters. The threshold value for detection is not well defined.
I reckon a better way may be to detect small islands, cut them out then append them (separated from the mainland and one each other by NaN) after the coordinates defining the mainland/main island.
The attached program does this:
(i) separate the coordinates into two subsets, one is the not-closed coastline of the mainland/main island (to be closed later manually), the other includes isolated islands;
(ii) compute the areas of those islands, then you may choose to retain only the largest of them, etc.
Hope it helps!
Script for cleaning up coastline data to be used in GridBuilder
Script for cleaning up coastline data to be used in GridBuilder
- Attachments
-
- CoastlineProcessing.zip
- (2.33 KiB) Downloaded 410 times