Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Map Viz #2

Open
ChakshuGautam opened this issue Aug 3, 2022 · 1 comment
Open

Custom Map Viz #2

ChakshuGautam opened this issue Aug 3, 2022 · 1 comment

Comments

@ChakshuGautam
Copy link

ChakshuGautam commented Aug 3, 2022

A React Component for Rendering Interactive Maps

Requirements

  1. Map focussed on a particular region (view bounds)
  2. Markers
    • Dynamic showing and deleting of markers based on external input
    • Show a marker in the center of the region
    • Clustering based on proximity
    • Icon Color
    • CSS on click
  3. Rerender the map on data change.
  4. Showing a legend
  5. Bounding a map with a GeoJSON. Showing a static color outside the GeoJSON.

Solution

In general, all map solutions have 3 aspects to them

  1. Map Tiles - for example OpenstreetMap, Mapbox, Google, Apple, etc.
  2. Map Library - for example Leaflet. Some solutions include 1 and 2 combined - Mapbox and Google.
  3. Map Config - a domain-driven config that acts as an input to the Map Library. It includes settings, markets, and geo boundaries that allow for the rendering of the map based on user inputs.

The solution proposes OpenstreetMap for the tiles, a react wrapper for leaflet as the map library, and the config below to render the maps. But could be replaced with other alternatives without any changes to other blocks. The thinking behind creating another layer of abstraction over and above the existing one (in react-leaflet) is to write a minimal spec that includes only the relevant APIs. This follows the principle of form follows function.

Any inputs based on the filters are assumed to be part of the preprocessing. This helps decouple the map capabilities from the data sources. It is upon the user of this react component to provide the data in the form of the input config shown below.

Input config

{
  "legend": {
    "display": true,
    "position": "bottom",
    "labels": [
      {
        "boxWidth": 20,
        "fontSize": 10,
        "fontColor": "#000",
        "fontFamily": "sans-serif",
        "fontStyle": "bold",
        "padding": 10,
        "label": "Legend"
      }
    ]
  },
  "bounds": {
    "byGeoJson": [],
    "byBbox": []
  },
  "markers": {
    "shouldClusterMarkers": true,
    "postions": [
      {
        "icon": "",
        "color": "",
        "tooltipCSS": "",
        "tooltip": "",
        "position": [
          20.4,
          94.1
        ]
      }
    ]
  },
  "overlays": [
    {
      "color": "#ff0000",
      "opacity": 0.5,
      "geoJson": []
    }
  ]
}
@ananya-jain1
Copy link

Use Cases - Link
BigQuery Tables - Link
ICCC Figma Mockups - Link

@radhay-samagra @ChakshuGautam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants