I had played with Folium a while back and recently started looking at OpenCage, so I though it would be great to use the two together to put markers on a global map based on natural language...
I had played with Folium a while back and recently started looking at OpenCage, so I though it would be great to use the two together to put markers on a global map based on natural language queries. It really wasn’t too difficult at all and I ended up with a neat little tool.
You can see an iPython notebook preview here. There’s also a simple command-line driver:
$ ./map_marker.py -h
usage: map_marker.py [-h] [-z ZOOM] [-k KEY] input output
Given a list of location queries, mark the locations on a Folium
(https://github.com/python-visualization/folium) map via the OpenCage
(https://geocoder.opencagedata.com/) geocoder service
positional arguments:
input a file with a list of queries (one query per line; use
"-" to read queries from stdin)
output a file where a folio.Map map will be written as HTML
optional arguments:
-h, --help show this help message and exit
-z ZOOM, --zoom ZOOM starting zoom level (default: 0)
-k KEY, --key KEY your OpenCage API key (get a key here:
https://geocoder.opencagedata.com/users/sign_up)
(default: None)
I had played with Folium a while back and recently started looking at OpenCage, so I though it would be great to use the two together to put markers on a global map based on natural language queries. It really wasn’t too difficult at all and I ended up with a neat little tool.
You can see an iPython notebook preview here. There’s also a simple command-line driver:
E.g.: