geoHashesForPolygon
duxy2002 opened this issue · comments
I'd noted that following comment in the geoHashesForPolygon method.
- Note, the algorithm 'fills' the polygon from the inside with hashes. So, if a geohash partially falls outside the polygon, it is omitted. So, if you have a polygon with a lot of detail, this may result in large portions not
being covered. To resolve this, manually choose a bigger geohash length. This results, in more but smaller
geohashes around the edges.
not only 'fills', I want to 'intersect' the polygon with smaller hashes, I means that even if a point of geohash is included in the polygon, I will remain the geohash. How can I do it?
You need to modify the algorithm to support this.
I modified the algorithm as the following:
while (detail < maxLength - 1) {
partiallyContained = splitAndFilter(polygonPoints, fullyContained, partiallyContained);
detail++;
}
partiallyContained = splitAndFilter2(polygonPoints, fullyContained, partiallyContained);
...........
and copy the splitAndFilter method as splitAndFilter2 and modified one line.
} else if (nw || ne || sw || se) {
//delete this stillPartial.add(h); and change to the following line.
checkCompleteArea.add(h);
👍 I might integrate this when I have some spare time; but right now not actively working on this project for the last few years.