Displaying points of interest (POI) on the map

It’s possible to specify which points of interest should be displayed on the map or turn them off completely.

After initialization Navmii SDK automatically downloads the list of POI categories which can be displayed. To get a notification when the download process has finished, you can add a listener via Sdk.addPoiCategoriesListener().

To retrieve the list of POI categories, use Sdk.getPoiCategories() method. Each category is represented by an object of class PoiCategory and has a unique identifier.

The default display state of each category comes from the server, but you can override it with PoiCategory.setShouldDisplayOnMap().

It’s also possible to show or hide all POI items at once with MapView.setPoiShownOnMap().

Setting Zoom Levels for POI Categories

The PoiCategory class includes a setZoomLevel() method, which allows you to specify the zoom level at which a particular category will begin to be displayed on the map.

Example:

PoiCategory category = Sdk.getInstance().getPoiCategory(7328); if (category != null) { category.setZoomLevel(14); }

With the above code, the POI category with ID 7328 (Bank) will become visible at zoom level 14 and will remain visible at higher zoom levels (i.e., 14-18).

Applying Zoom Levels and Visibility Flags to Multiple Categories Simultaneously

To set visibility or zoom levels for multiple categories, it's recommended to use dedicated methods provided in the SDK for performance considerations.

The methods to be used are Sdk.setPoiCategoriesDisplayedOnMap() and Sdk.setPoiCategoriesZoomLevels(). Both methods accept arrays of identifiers and the corresponding values to set.

For instance, to set zoom levels for all categories simultaneously, use the following code:

PoiCategory[] categories = Sdk.getInstance().getPoiCategories(); int[] ids = new int[categories.length]; int[] zoomLevels = new int[categories.length]; for (int i = 0; i < categories.length; ++i) { ids[i] = categories[i].getId(); zoomLevels[i] = 14; } Sdk.getInstance().setPoiCategoriesZoomLevels(ids, zoomLevels);

Please be aware that the minimum zoom level you can specify using the aforementioned methods is 8. At zoom levels below 8, POI rendering is disabled.