OpenMaine / campaign-finance

Initially, campaign finance information for the 2019 Portland Mayoral Elections.
2 stars 0 forks source link

Subproject: Mapping where donations come from #9

Open congdon opened 5 years ago

congdon commented 5 years ago

We hope that a facet of this system will be to have maps of the contributors' locations (zipcodes and within Portland, ward-precinct info).

maxterry commented 4 years ago

I'm interested in taking this on. I've implemented web maps several times over the years, using Google Maps, OpenLayers, Leaflet, Mapbox...

Preferences / requirements on tech choice?

congdon commented 4 years ago

Hi Max -- Sounds great to me!

FWIW, the big goal is to create a system that could be reused for a variety of campaigns. E.g., it would have been nice to do the city councillors for this election, too, but data entry became a much larger bottleneck than we expected.

The only mapping I've ever done is in D3, and that's not the right thing for this... Do you have a preferred path, and do you have the energy to layout pros/cons for different possible paths? (If you have a preferred path, then likely that's the best path, though.)

I guess another notion to think about is creating a mapping system that could be used for multiple OpenMaine projects (given input data of a specific form, of course). And what I'm trying to get at there is: Is there a path that might be easier for others to pick up? That's not necessarily the most important thing, though. I'm just trying to move us to sort of a 'default technology stack' that we'd use for the group.

One more thought: Possibly (probably?), mapping itself should be a distinct github repo, even if you're thinking specifically about the campaign finances.

Sorry to carry on so. :-) Thank you for stepping up!

maxterry commented 4 years ago

Thanks @congdon, the approach and priorities you described sounds right on to me.

For a reusable, easiest-to-use, FOSS solution, thinking Leaflet + OpenStreetMap tiles looks like the best bet.

Agree that D3 doesn't seem the best fit here. We use ECharts at my current work, including for some geo stuff, and that also has unrelated complexity and missing mapping features.

Mapbox has a nice mapping lib and nice tiles, but require managing API keys / accounts, as closed source / commercial.

Google Maps is too unpredictable in terms of pricing and being-from-Google (e.g. https://geoawesomeness.com/developers-up-in-arms-over-google-maps-api-insane-price-hike). Looks like OpenLayers is still being maintained, and has some more advanced GIS features, but I originally went to Leaflet because they had a cleaner, less verbose, more accessible API.

Apple Maps is improving (https://www.justinobeirne.com/new-apple-maps) and MapKit JS (https://developer.apple.com/maps/web/) works pretty well on DuckDuckGo, doesn't seem mature enough and uncertain on Apple's future moves, but worth keeping an eye on.

Anyway, I'll put together a proof-of-concept with Leaflet + OpenStreetMaps for consideration/feedback over the next few days, and we can go from there.

congdon commented 4 years ago

So great! Thank you, Max!

maxterry commented 4 years ago

I tried out a few different approaches, here's a proof-of-concept with React + Leaflet + OSM:

https://codesandbox.io/s/openmaine-maps-35zt4

The JS source file is in src/index.js and GeoJSON data in data directory. It loads OSM tiles, centers on Maine, and adds a few counties and city halls from GeoJSON.

I'll follow-up later today or over the weekend with the pros and cons I see with these libraries/tilesets.

Questions and feedback welcome!

maxterry commented 4 years ago

Just getting a chance to circle back to this now.

React has gained a lot of market share over Angular in the past couple years:

https://trends.google.com/trends/explore?date=2015-01-01%202019-12-17&geo=US&q=%2Fm%2F012l1vxv,%2Fg%2F11c6w0ddw9,%2Fg%2F11c0vmgx5d

While I've personally used Angular/AngularJS professionally for years, and found effective enough, I think React provides a simplicity + resume-building motivation that may encourage contributions (React job listings seem on the rise, both locally and remote).

I tend to prefer vanilla JS for personal projects/experiments, but seems like there's value in tapping into the React ecosystem/community for this. That said, here's an alternative version without React or any other framework to consider / compare against: https://codesandbox.io/s/openmaine-maps-vanilla-js-chk59

Leaflet seems to strike the right balance between ease of use and features for civic maps. There was a good discussion of Leaflet vs. OpenLayers vs. Mapbox on Hacker News last week:

https://news.ycombinator.com/item?id=21754642

OpenStreetMap was easy enough to get set up, but the current implementation relies on hosted tiles. Tiles can be self-hosted with e.g. openmaptiles.org, but looks like a fair bit of work to get/keep running (plus potential hosting costs).

Finally, GeoJSON is easy to read and write, and is well supported. I've found it generally easier to work with than Shapefiles (switchfromshapefile.org), KML, etc. for most projects (i.e. unless hardcore GIS flexibility or perf requirements).

Thoughts @congdon and others?

If agreement on going in this general direction, maybe a new repo for reusable map-related things could be set up at github.com/OpenMaine/maps ?

congdon commented 4 years ago

Hey @maxterry,

Thank you for doing all this! (And apologies that I've been swamped with other things.) Your proof-of-concept demos are really nice -- and the references are very helpful, too!

I am on board with your decision making process and your path.

I will make the new repo next. I guess I'll also make a Slack channel for people who want to be involved -- I imagine it will be low traffic, but it will maybe help interested people find this effort and participate.

maxterry commented 4 years ago

Thanks @congdon, I just pushed an initial version to the mapping repo you set up.