diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java index 782cd40ecf..a4e2774996 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java @@ -227,6 +227,19 @@ public class BinaryMapIndexReader { return false; } + public boolean containsMapData(int left31x, int top31y, int right31x, int bottom31y, int zoom){ + for(MapIndex mapIndex : mapIndexes){ + for(MapRoot root : mapIndex.getRoots()){ + if (root.minZoom <= zoom && root.maxZoom >= zoom) { + if (right31x >= root.left && left31x <= root.right && root.top <= bottom31y && root.bottom >= top31y) { + return true; + } + } + } + } + return false; + } + public boolean containsAddressData(){ return addressIndexes.size() > 0; } diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index a460549dfc..5dc436fc08 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -256,6 +256,10 @@ public class MapRenderRepositories { if (basemapSearch && !mapName.toLowerCase().contains(BASEMAP_NAME)) { continue; } + BinaryMapIndexReader reader = files.get(mapName); + if(!reader.containsMapData(leftX, topY, rightX, bottomY, zoom)) { + continue; + } if (!nativeFiles.contains(mapName)) { nativeFiles.add(mapName); if (!library.initMapFile(mapName)) {