diff --git a/OsmAnd/src/net/osmand/plus/AmenityIndexRepositoryBinary.java b/OsmAnd/src/net/osmand/plus/AmenityIndexRepositoryBinary.java index 9a4b726d69..5b86c0234a 100644 --- a/OsmAnd/src/net/osmand/plus/AmenityIndexRepositoryBinary.java +++ b/OsmAnd/src/net/osmand/plus/AmenityIndexRepositoryBinary.java @@ -11,6 +11,7 @@ import net.osmand.Algoritms; import net.osmand.LogUtil; import net.osmand.ResultMatcher; import net.osmand.binary.BinaryMapIndexReader; +import net.osmand.binary.BinaryMapIndexReader.MapIndex; import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.data.Amenity; @@ -77,8 +78,13 @@ public class AmenityIndexRepositoryBinary implements AmenityIndexRepository { try { amenities = index.searchPoiByName(req); if (log.isDebugEnabled()) { - log.debug(String.format("Search for %s done in %s ms found %s.", //$NON-NLS-1$ - query, System.currentTimeMillis() - now, amenities.size())); //$NON-NLS-1$ + String nm = ""; + List mi = index.getMapIndexes(); + if(mi.size() > 0) { + nm = mi.get(0).getName(); + } + log.debug(String.format("Search for %s done in %s ms found %s (%s).", //$NON-NLS-1$ + query, System.currentTimeMillis() - now, amenities.size(), nm)); //$NON-NLS-1$ } } catch (IOException e) { log.error("Error searching amenities", e); //$NON-NLS-1$ diff --git a/OsmAnd/src/net/osmand/plus/PoiFilter.java b/OsmAnd/src/net/osmand/plus/PoiFilter.java index 5a9770eb36..4f4482c50a 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/PoiFilter.java @@ -136,10 +136,10 @@ public class PoiFilter { double baseDistX = MapUtils.getDistance(lat, lon, lat, lon - 1); double distance = distanceToSearchValues[distanceInd] * 1000; - double topLatitude = lat + (distance/ baseDistY ); - double bottomLatitude = lat - (distance/ baseDistY ); - double leftLongitude = lon - (distance / baseDistX); - double rightLongitude = lon + (distance/ baseDistX); + double topLatitude = Math.min(lat + (distance/ baseDistY ), 84.); + double bottomLatitude = Math.max(lat - (distance/ baseDistY ), -84.); + double leftLongitude = Math.max(lon - (distance / baseDistX), -180); + double rightLongitude = Math.min(lon + (distance/ baseDistX), 180); return searchAmenities(lat, lon, topLatitude, bottomLatitude, leftLongitude, rightLongitude, matcher); }