Copyright | (c) 2015, Markenwerk, Jan Greve |
---|---|
License | MIT |
Maintainer | jg@markenwerk.net |
Safe Haskell | None |
Language | Haskell2010 |
This is supposed to offer an easy to use abstraction of the google geocoding web service.
A minimum example of usage (with OverloadedStrings
) is:
import GeoRequester main = geoRequest "Lornsenstraße 43, Kiel" >>= putStrLn . show
While there are convenience functions for the most common use cases, there are means to send arbitrary requests.
If you do so, please see Geocoder.Parser for ways to access the results.
As a hint, GoogleAnswer
is instance of Foldable
and Functor
.
Please note that this Package is also meant to demonstrate basic Haskell features and thus not always takes the most elegant way but the most educational way.
- geoEncode :: Maybe String -> String -> IO (Either String (Double, Double))
- geoEncodeLanguage :: Maybe String -> String -> String -> IO (Either String (Double, Double))
- geoDecode :: Maybe String -> (Double, Double) -> IO (Either String String)
- geoDecodeLanguage :: Maybe String -> (Double, Double) -> String -> IO (Either String String)
- geoRequest :: GoogleRequest -> IO (Either String (GoogleAnswer GoogleResult))
- geoRaw :: [(String, String)] -> IO (Either String (GoogleAnswer GoogleResult))
Encoding
:: Maybe String | Optional API key to use if you intend to go over the courtesy limit Google imposes |
-> String | The address to be looked up. |
-> IO (Either String (Double, Double)) | Either an error message or the result. |
Encodes a given address into a coordinate.
:: Maybe String | Optional API key to use if you intend to go over the courtesy limit Google imposes |
-> String | The address to be looked up. |
-> String | Language to be used. cf. https://developers.google.com/maps/faq#languagesupport |
-> IO (Either String (Double, Double)) | Either an error message or the result. |
Encodes a given address into a coordinate.
Decoding
:: Maybe String | Optional API key to use if you intend to go over the courtesy limit Google imposes |
-> (Double, Double) | coordinate to be decoded |
-> IO (Either String String) | Either an error message (Left) or the result (Right). |
Reverse geocoding of a given coordinate pair into an address.
:: Maybe String | Optional API key to use if you intend to go over the courtesy limit Google imposes |
-> (Double, Double) | coordinate to be decoded |
-> String | Language to be used. cf. https://developers.google.com/maps/faq#languagesupport |
-> IO (Either String String) | Either an error message (Left) or the result (Right). |
Reverse geocoding of a given coordinate pair into an address.
Raw Requesting
geoRequest :: GoogleRequest -> IO (Either String (GoogleAnswer GoogleResult)) Source
Sends a request based on a GoogleRequest
.
geoRaw :: [(String, String)] -> IO (Either String (GoogleAnswer GoogleResult)) Source
Sending a raw request to the api, if you want more control than the above methods offer.
Uses a pair of key-value pairs to generate the actual query.
See GeoResolver.Parser for a helping hand using the resulting GoogleAnswer
.