Copyright | (c) Marco Zocca 2018 |
---|---|
License | GPL-3 |
Maintainer | zocca.marco gmail |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Geocoding
Running requests
:: (FromJSON a, Floating a) | |
=> Creds | API key (available for free on https://developer.mapquest.com) |
-> GeoQuery | Location to be queried |
-> IO (Maybe (Coords a)) |
Call the MapQuest Geocoding API with a given address and extract the coordinates from the parsed result.
Example usage : assuming the user has bound key to hold the API key string, the following can be run in a GHCi shell :
>>>
runRequest key (GQ "Via Irnerio" "Bologna" "Italy")
Just (Coords {lat = 44.49897, long = 11.34503})
>>>
runRequest key (GQFree "Ngong Ping 360, Hong Kong")
Just (Coords {lat = 22.264412, long = 114.16706})
Parameters
The user's API credential (i.e. the MapQuest "consumer key", visible at https://developer.mapquest.com/user/me/apps )
Geocoding query parameters