Small utility to geocode using the nice Mapzen Search geocoder.
This tool simply encodes the first argument and passes it to curl. The result is passed to jq to extract the first result and then using json2csv converts the array result into a couple of coordinates.
So using it is as easy as:
% geocode.sh "valencia"
"Valencia, Municipio Valencia, Venezuela",-68.00765,10.16202,0.947
% geocode.sh "valencia,spain"
"Valencia, Província de València, Spain",-0.37739,39.46975,0.956
Results will be:
- Complete name of the place
- Latitude
- Longitude
- Confidence of the result
Feel free to adapt, extend to your requirements.
<3