CartoDB / carto-react

CARTO for React packages
https://docs.carto.com/react/
MIT License
38 stars 17 forks source link

[RFC] Add a territory selector widget #474

Open efernandezleon opened 2 years ago

efernandezleon commented 2 years ago

Target Use Case

Many projects from PS need the functionality of filtering some layers (and widgets) based on territory (state, city, county, DMA, FSA, ...). Some examples of projects that use this feature would be Telus Insight or Radarview, where a user wants to focus the data exploration on a specific geometry that comes from a well-known territory.

Implementation Proposal

To cover this functionality, the framework C4R could provide a widget composed of a UI component to select a territory (single dropdown select or autocomplete) that uses a source to show the geometry in the map by using the Spatial Filter to filter some layers. An extra ball for business strategy could be to support directly territory geometries from the DO, like https://carto.com/spatial-data-catalog/browser/geography/cdb_block_96b823a2/ or https://carto.com/spatial-data-catalog/browser/geography/mbi_counties_46ea8aaa

Some options for this widget can be:

padawannn commented 2 years ago

You can load a GeoJson layer that represents the territory selected and add the spatial filter using the addSpatialFilter action

efernandezleon commented 2 years ago

@padawannn Yes, that would be the under-the-hood implementation, we can develop a reusable widget with minimum configuration to cover the feature. The point is if you think this widget could be interesting to add as an official C4R widget.

alasarr commented 2 years ago

+1 to this feature. Can you go further and define how the API will look like for this widget?

I will keep this very simple right now. You should need from the user: