code-for-montana / nonprofit-data

A tool to help make data about nonprofit organization more accessible.
MIT License
5 stars 2 forks source link

Create an initial "map" component #2

Open glesica opened 4 years ago

glesica commented 4 years ago

Since the first part of this project is focused on creating a map of Montana nonprofits, we will need a full-window map component. Not sure what it should be built on, but Leaflet.js seems promising. Bonus points for relying on OSM for the mapping data since it's also a community-driven project. Additionally, we may be able to even augment OSM itself later with some of our data to make things simpler.

eidietrich commented 4 years ago

Maybe late to this, but I'd suggest we try to use vector tiles (which provide smoother UX on zooming) instead of the default Leaflet raster base map. Resource below suggests a mapbox-gl-leaflet library:

https://openmaptiles.org/docs/website/leaflet/

eidietrich commented 4 years ago

I've committed to mocking up our planned map view:

Three zoom levels

eidietrich commented 4 years ago

I've made enough progress to check in here w/ a rough implementation of what we discussed the week before last.

New components should be pushed to the repo on the three-tier-view branch. I haven't integrated them into the primary app pending Smai's front-end framework being ready but you can see where I'm at with a Storybook setup. Run npm i to get storybook and the D3 libraries I've used, then npm run storybook to open up its component viewer. The main mock ups are in the ThreeTierMap category, which has a few prepackaged views. Note I've used an old data file that looks like an incomplete list of nonprofits, and also doesn't have any budget/category fields to use to make the city-level view interesting.

I think I've set up these maps so it'll be pretty quick to iterate on design specifics (colors, label formatting, etc.), but want to talk through whether the overall approach is working before putting any more time in. I'm also curious how the approach I've taken squares to the D3-in-React stuff Smai was experimenting with.

Work remaining: