-
Notifications
You must be signed in to change notification settings - Fork 10
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
Revisit candidates feature #188
Comments
We want to get to a point where you can input your address and out pops a list of your candidates and ballot questions. @robkorobkin did some work figuring out how to replicate the state's district lookup tool in this site: http://groundgamer.org/ Can we replicate this on Maine Ballot? Details from Rob about what he did below: Nothing's minified, and there are comments and variable / function names that actually make sense, so whoever's coding for you should hopefully have an okay time reading it? If you're curious how I handle going from an address to identifying the legislative district for that address, here's the technobabble: So, the first thing I did was get the GIS lat/lon boundary points of each legislative region out of the State's GIS archive, which I then wrote a script to convert to JSON: For data files, they're actually not that hard to read. Just a bunch of (lat,long) coordinates that pin out the boundaries of each legislative district. Then, since I now had the districts as JSON, it wasn't all that hard to feed them into the Google Maps JS SDK to create the district overlay polygons that you see when you load the app. The UI for the app contains a little form that takes an address, and then pings it to Google's geocode API, which spits back the lat/lon of the target address: Then, this is where the magic happens, there's a little javascript function that iterates through the list of displayed polygons to see if each polygon contains the specified location. Ie: it goes through all the districts (which are now loaded onto the map) and checks to see if your address (which you just got back from the API) is contained within it. -- Hopefully this won't be too hard for you guys to implement into your thing. Basically all you should need to do so is:
-- Hope this helps. All the stuff for GroundGamer.org is here: |
More from Rob: That’s probably what you actually want. It’s a fun dataset to have the boundaries of all the legislative districts in the state, like I’m working with here, and you obviously need it if you want to map out all the districts on a single map, etc. But if that’s not what you’re trying to do, that’s some serious overkill. It’s effectively drawing a detailed map of the state before you can find out about a single place on that map. Just ping this: |
This is the spreadsheet we use for local websites: And candidates: |
@mfras3r started working on this, if anyone wants to pick up where he left off. |
There is a spreadsheet of candidates for the June election, if anyone wants to play around with it. |
Need to decide whether it's worth keeping and if we can make improvements with the data we have.
The text was updated successfully, but these errors were encountered: