okfn-brasil / vitimas-da-intolerancia

Conheça as vítimas de ódio político
https://vitimasdaintolerancia.org/
GNU Lesser General Public License v3.0
101 stars 10 forks source link

Create a map using LeaftLet #5

Open turicas opened 6 years ago

turicas commented 6 years ago

We have city and state, so we can geolocate these points and then use LeaftLet to show a simple map. Example here.

ellisonleao commented 6 years ago

i can try this one

vgeorge commented 6 years ago

If input data has a column identifying the city with an IBGE id it will be possible to use coordinates from this file.

vgeorge commented 6 years ago

A "cities" file could added to the Google Sheets file as an auxiliary tab. At "Casos" tab the coordinates could be fetched using VLOOKUP searching for ibge_city_id, so we don't need to georeference at the front-end.

ellisonleao commented 6 years ago

@turicas are the lat, lng codes going to be populated in the spreadsheet ?

turicas commented 6 years ago

@ellisonleao yes! In the "case" spreadsheet. :) I can populate it, we need to change the models to load it and then use it on the frontend.

ellisonleao commented 6 years ago

@turicas ok, can you add a fixture sample as well so i can test on my side, please?

vgeorge commented 6 years ago

I made a copy of the table and added a mechanism to generate coordinates of the cases from city codes:

https://docs.google.com/spreadsheets/d/1UlkevRSDmnqMDxaE_mjNqxf_y-paGd6qbYAIpgVBL-g/edit?usp=sharing

ellisonleao commented 6 years ago

hey @vgeorge, thanks for the help. Looks like the lat and lng fields are going to be a in a single column, splitted by ,. E.g: 12.23,-5.234 . The current code that i am using is parsing in that way.

ocefpaf commented 6 years ago

The approach in #14 is probably better but here is an example on how to achieve this with geopy and folium. The folium map can be saved as a stand-alone HTML.

http://nbviewer.jupyter.org/gist/ocefpaf/3bb0a42943aad9560642e0088df936f8

vgeorge commented 6 years ago

@ellisonleao I've changed the file, now the coordinates are stored in a lonlat field.

vgeorge commented 6 years ago

@ellisonleao I don't have write access to the official doc, someone has to add the changes there.