0

I'm using the bkde2D {KernSmooth} function on a dataset that has no repetitions of coordinates. while trying to present the data on a map I get this error "less than 4 coordinates in ## polygon". .In a different dataset, there is no problem so I guess it's related to the current data. How can I overcome this problem?

  • Can you edit your question to show the function you run, and maybe the output from "summary" on all the things you are passing as argument? And if you can link us to the data or show us how to create a data set that replicates the problem that would be ideal. Otherwise we're guessing a bit. – Spacedman Nov 12 '17 at 16:52
  • Isn't it just a warning? Polygon(cbind(c(0, 0), c(1, 0))) Polygon(cbind(0, 0)) - these faithfully produce nonsense 4-coord polygons. – mdsumner Nov 29 '17 at 20:39
  • It's obvious what is being asked here, if you can provide an example maybe we can reopen and actually list some help. – mdsumner Nov 29 '17 at 20:41
6

Might be a hint that you have non valid geometries that you should clean up first. You need at least 4 coordinate pairs to build a valid polygon. The smallest possible is a triangle. As the polygon is built with an additional endpoint on top of the startpoint you need for a triangle 4 coordinates. Everything less is something that many tools have problems working with as you do not really have a polygon.

| improve this answer | |
  • 1
    yes, I'm guessing that if OP runs some cleanup on his/her data (some software is going to assume an implicit polyline from the final vertex listed in the polygon to the originating vertex). If that is the case (op hints it is because he/she says no coordinate duplication) he/she should run some task to just add first vertex in polygon to the very end and should be just fine. – Conor Nov 12 '17 at 17:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.