icipe-official / icipe-official/vectoratlas-software-code

Zoom to country when country filter applied

Open
#435 0 comments 0 reactions 1 assignee View on GitHub

@main-tech is already working on this.

Since Feb 14, 2023.

Dominant language
TypeScript
Stars
2
Forks
8
Avg merge
5d 4h
Merged PRs (30d)
11

Description

When a single country is selected in the map filter, we want to zoom in to that selected country. When multiple countries are selected, we remain on the current zoom level. Only zoom when we go from 0 to 1 country selected.
The view.fit function can be used from https://openlayers.org/en/latest/examples/clusters-dynamic.html (e.g. view.fit(extent, {duration: 500, padding: [50, 50, 50, 50]});), but the bounds of the country window have to be specified. These can be got from the country feature - using something like:
if (feature.get('NAME) === 'Uganda') { const extent = (feature as RenderFeature).getExtent()) }

AC's:

  • When a single country is selected on the map filter, the map zooms in to show this country, with a bit of padding. This should be debounced to only zoom a short while after the country is selected.
  • When the filter is removed, or when multiple countries are selected, the map remains zoomed. Only zoom when we go from 0 to 1 country selected.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.