Reduce points in polygon

Hi there,

I have a text file created with grdcontour that gives me a set of lines and polygons.
To reduce the number of points I used simplify there’s just so much it can do.

More specifically, within a polygon (or segment), I want to search for very close points and replace both by a mean position. (gmt spatial?)

Any idea ?

Best,

Well, gmtselect lets selecting points that are with a search radius of given points. I’m not seeing, however, what would be a good strategy to select those knot points.

Neither do I…
I think there’s something down the spatial rabbit hole… But I can’t pinpoint it. Therefore my post :slight_smile:

I have no idea what you’re trying to do, but if you need to do spatial analysis, you should consider trying PostGIS.

You are probably correct, but for the time being, I am looking at a pure GMT solution.

If the project gets more serious I’ll probably move to a C++ library that does exactly what I need…

What I try to do is to have the least amount of points to describe isocontours. The crux is cross-intersection. simplify doesn’t handle this kind of test but if I pre-process correctly the data with grdfilter I can somewhat get a satisfying result… apart from these remaining points within a polygon that are very close from each other but can’t be removed with simplify.

I’m afraid I’m still missing something. Isn’t exactly this what de Doglas-Peucker algorithm do?

Yep, that was a pain point of creating lower resolution coastlines from the higher one. But do contours create

It does, but it is limited… See the illustration above (green to blue point). The Douglas algorithm is in the simplify step.

And how did you do?

Manual edition.

Sorry but your plot is not clear to me. It looks that some parts where hand drawn. Points are made by groups of points, etc. Like this I can’t see the limitation of the DP.

:cry:

It is all hand drawn. I sketched it to illustrate the problem… Despite being unfortunate, manual edition is indeed an option…

Thanks :slight_smile: