Fix strange problems with empty set
This commit is contained in:
parent
7e2dfb4344
commit
56bc3a14c2
1 changed files with 10 additions and 4 deletions
|
@ -556,6 +556,9 @@ public class OsmMapUtils {
|
|||
|
||||
// take centroid as the first best guess
|
||||
Cell bestCell = getCentroidCell(rings);
|
||||
if(bestCell == null) {
|
||||
return new LatLon(minX, minY);
|
||||
}
|
||||
|
||||
// special case for rectangular polygons
|
||||
Cell bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, rings);
|
||||
|
@ -607,6 +610,9 @@ public class OsmMapUtils {
|
|||
}
|
||||
|
||||
if (area == 0) {
|
||||
if (points.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
LatLon p = points.get(0);
|
||||
return new Cell(p.getLatitude(), p.getLongitude(), 0, rings);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue