Copyright | License : GPL-3 |
---|---|
Maintainer | hahn@geoinfo.tuwien.ac.at |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Requests the http://geocoder.opencagedata.com geocoding service to get latitude and longitude values from an address. Uses Aeson to convert the response from JSON to Haskell types.
- data QueryParameters = QueryParameters {
- para_q :: Text
- para_key :: Text
- para_language :: Maybe Text
- para_pretty :: Maybe Text
- para_bounds :: Maybe Text
- para_country :: Maybe Text
- para_fields :: Maybe Text
- defaultParams :: QueryParameters
- type TokenToGeocode = Text
- type GeoCageDeveloperKey = Text
- getAPIResponse :: TokenToGeocode -> GeoCageDeveloperKey -> IO (Maybe ResponseBody)
- getAPIResponseWith :: QueryParameters -> IO (Maybe ResponseBody)
- geocode :: TokenToGeocode -> GeoCageDeveloperKey -> IO [Result]
- geocodeWith :: QueryParameters -> IO [Result]
- geocodeGeoTokensList :: [TokenToGeocode] -> GeoCageDeveloperKey -> IO ()
- createGeocoderParams :: QueryParameters -> [TokenToGeocode] -> [QueryParameters]
- data ResponseBody = ResponseBody {}
- data Result = Result {
- bounds :: Bounds
- components :: Components
- confidence :: Integer
- formatted :: Text
- geometry :: Location
- data License = License {}
- data Rate = Rate {}
- data Status = Status {}
- data Timestamp = Timestamp {}
- data Components = Components {}
- data Location = Location {}
- data Bounds = Bounds {}
Documentation
data QueryParameters Source
data type including all possible parameters OpenCage API offers
QueryParameters | |
|
defaultParams :: QueryParameters Source
minimal example of QueryParameters can be used to create your own parameters
type TokenToGeocode = Text Source
type GeoCageDeveloperKey = Text Source
:: TokenToGeocode | token to geocode |
-> GeoCageDeveloperKey | OpenCage key |
-> IO (Maybe ResponseBody) | if the geocoding was successful there is a ResultBody full of data returned |
Minimalistic version to geocode a token returning the whole Response
:: QueryParameters | parameters included into the request |
-> IO (Maybe ResponseBody) | if the geocoding was successful there is a ResultBody full of data returned |
main geocode function, called by all other functions, deals with errors
:: TokenToGeocode | token to geocode, empty if an error occured |
-> GeoCageDeveloperKey | OpenCage key |
-> IO [Result] | list of results |
geocodes the token and returns a list of results
:: QueryParameters | parameters included into the request |
-> IO [Result] | list of results, empty if an error occured |
geocodes the token included into the QueryParameters respecting all values set in the QueryParameters returns an empty list if an exception occured or the result was empty
:: [TokenToGeocode] | list of tokens to geocode |
-> GeoCageDeveloperKey | OpenCage key |
-> IO () | prints the result |
geocodes a list of tokens and prints the results
:: QueryParameters | parameters that should be used for all tokens in the list |
-> [TokenToGeocode] | list of tokens to geocode |
-> [QueryParameters] | list of parameters, for every token one QueryParameter entry is included |
packs tokens into QueryParameters and returns this as a list if you want to specify your own parameters use this function
Result | |
|
data Components Source
Show Components | |
Generic Components | |
FromJSON Components | not all components are included into the response, if so there is an empty string as default value |
type Rep Components |