Widget Tricks - ods-map: Refine & Zoom

Map as a selector

In this example, the french administrative regions are displayed first and the user click refines on the departments dataset. On the right section you can observe the applied filter on departments context and the list of departments returned. The ‘regions’ context is not affected and is not filtered. Note that it would also be possible to apply the filter on regions context, to do so, please have a look to the next resource of this page.

If your layer is displayed as raw or aggregation, you can configure a layer so that a click on an item triggers a refine on another context, using refineOnClickContext. One or more contexts can be defined:

Map drilldown

In this example, the french administrative regions are displayed first, the user click refines on both regions and departments datasets and will then display departments in the selected region. Another click on a departement will refine departements and cities datasets and display cities in this department.

If your layer is displayed as raw or aggregation, you can configure a layer so that a click on an item triggers a refine on another context, using refineOnClickContext. One or more contexts can be defined:

Dynamic map by zoom level

In this example, the French administrative regions, departments and cities are displayed in a specific zoom range. Regions from the minimum to 6, Departments from 7 to 8, Cities from 9 to the maximum

You can also configure layers to only be visible between certain zoom levels, using show-zoom-min, show-zoom-max, or both.

Replace map tooltip with a refine : in a pop-in !

In this example, refineOnClick will be used to open a modal on top on the map. It’s a good alternative to map tooltips, specially when their is a lot of content to display. It’s also easier to get contexts and refines from the page as default tooltips are in an isolated scope. that means that actions performed in the tooltip can’t have any effect on the page. In this example, modals are simple html blocs, displayed when a refine is active.

Replace map tooltip with a refine : on the side !

In this example, refineOnClick will be used to display record details on the side of the map. It’s a good alternative to the pop-in version.

To highlight the selected point on the map, the refined context is displayed. To achieve this, the context must be refined by a field that contains an unique name or ID, and therefore this field must be set has a filter/facet on the dataset.

Replace map tooltip with a refine : see the aggregation !

In this example, in combination with ods-color-gradient to display a choropleth map, the refineOnClick is used to select a department and activate KPI cards on top of the map.

  • the first KPI card displays the aggregation result from ods-color-gradient and display it’s value
  • the second KPI card get the name of the selected department, through an ods-results on the refined context
  • the third KPI card computes a new aggregation with ods-adv-analysis