Forum Discussion
Anonymous
9 months agoNot applicable
Azure Maps β Dynamic zoom when filtering polygons from a single GeoJSON?
Hi everyone, I am using Azure Maps in Power BI, and I have multiple areas/polygons stored inside one single GeoJSON file. I want to allow the user to filter the report (for example using a slicer...
- 9 months ago
Hello Anonymous,
This behaviour is expected because the Azure Maps visual calculates the zoom level based on the full extent of the GeoJSON file, even when the data is filtered in Power BI. Unfortunately, there is currently no native option to automatically recalculate the extent only for the visible data after filtering.Recommended Approaches
1. Split the GeoJSON into multiple files (recommended)
Instead of using a single GeoJSON containing all areas, create a table with a column that holds the specific GeoJSON for each area. When the user selects an area in the slicer, the visual will load only the corresponding file, automatically adjusting the zoom.This can be achieved in Power Query:- Import the GeoJSON.
- Expand the polygons and create a column with the individual JSON for each area.
- Link this table to the slicer.
f this answer was helpful in any way, I would be pleased to receive a thumbs-up, as well as the satisfaction of seeing a DAX measure work for the first time without needing yet another FILTER.
Please mark it as the accepted solution. This helps other community members find the quickest path and saves them from another endless loop π.
Nabha-Ahmed
9 months agoSuper User
Hi Anonymous
This happens because Azure Maps calculates zoom/extent based on the full GeoJSON geometry, even if you filter features. Filtering only hides the data; it doesnβt change the underlying geometry.
Workarounds:
- the GeoJSON by area β have one file per area, then use a slicer to dynamically load the selected file. This ensures correct zoom.
- Use pre-calculated centroids β create a table with each areaβs center coordinates and zoom level, and bind the map to these measures. Works best for highlighting, less so for full polygons.
Recommendation: Splitting the GeoJSON per area is usually the simplest way to get proper zoom for each selection.
i hope this help you