-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Google Maps Geocoding API bindings -- -- The Google Maps Geocoding API provides a direct way to access -- geocoding and reverse geocoding services via an HTTP request. This -- library package provides bindings in Haskell to that API. NB: The use -- of the API's services is subject to the Google Maps APIs Terms of -- Service, which terms restrict the use of content (eg no use without a -- Google map). @package google-maps-geocoding @version 0.1.0.1 -- | This package has no connection with Google Inc. or its affiliates. -- -- The Google Maps Geocoding API provides a direct way to access -- geocoding and reverse geocoding services via an HTTP request. This -- library provides bindings in Haskell to that API. -- -- NB: The use of the Google Maps Geocoding API services is subject to -- the Google Maps APIs Terms of Service, which terms restrict the -- use of content (eg no use without a Google map). -- -- The components and optional parameters in a geocoding request -- are not yet implemented. The reverse geocoding request is not yet -- implemented. -- -- The code below is an example console application to test privately the -- use of the library with the Google Maps Geocoding API. -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- module Main (main) where
--
-- import Data.Text (Text)
-- import Data.Text.IO as T (getLine, putStr)
-- import Network.HTTP.Client (newManager)
-- import Network.HTTP.Client.TLS (tlsManagerSettings)
-- import Web.Google.Maps.Geocoding (Address (..), geocode, GeocodingResponse (..),
-- Geometry (..), Key (..), Location (..), Result (..), Status (..))
-- import System.IO (hFlush, stdout)
--
-- main :: IO ()
-- main = do
-- putStrLn "A test of the Google Maps Geocoding API.\nNB: The use of the \
-- \API services is subject to the Google Maps APIs Terms of Serivce at \
-- \https://developers.google.com/maps/terms.\n"
-- txt <- input "Enter ful address: "
-- mgr <- newManager tlsManagerSettings
-- let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>"
-- result <- geocode mgr apiKey (Address txt)
-- case result of
-- Right response -> do
-- let s = status response
-- case s of
-- OK -> do print $ location $ geometry $ head $ results response
-- putStrLn "Display the location by visiting \
-- \maps.google.com on the web and entering the latitude \
-- \and longitude."
-- _ -> putStrLn $ "Error! Status: " ++ show s
-- _ -> putStrLn $ "Error! Result:\n" ++ show result
--
-- input :: Text -> IO Text
-- input msg = T.putStr msg >> hFlush stdout >> T.getLine
--
module Web.Google.Maps.Geocoding
-- | Geocode. NB: The use of the Google Maps Geocoding API services is
-- subject to the Google Maps APIs Terms of Service.
geocode :: Manager -> Key -> Address -> IO (Either ServantError GeocodingResponse)
-- | Google Translate API
type GoogleMapsGeocodingAPI = "json" :> (QueryParam "key" Key :> (QueryParam "address" Address :> Get '[JSON] GeocodingResponse))
-- | API type
api :: Proxy GoogleMapsGeocodingAPI
-- | API key
newtype Key
Key :: Text -> Key
-- | Address
newtype Address
Address :: Text -> Address
-- | Geocoding Reponse
data GeocodingResponse
GeocodingResponse :: Status -> Maybe Text -> [Result] -> GeocodingResponse
[status] :: GeocodingResponse -> Status
[error_message] :: GeocodingResponse -> Maybe Text
[results] :: GeocodingResponse -> [Result]
-- | Contains the status of the request and may contain debugging
-- information to help you track down why geocoding is not working.
data Status
-- | Indicates that no errors occurred; the address was successfully parsed
-- and at least one geocode was returned.
OK :: Status
-- | Indicates that the geocode was successful but returned no results.
-- This may occur if the geocoder was passed a non-existent address.
ZeroResults :: Status
OverQueryLimit :: Status
RequestDenied :: Status
-- | Generally indicates that the query (address, components or latlng) is
-- missing.
InvalidRequest :: Status
UnknownError :: Status
-- | A result of the geocoder.
data Result
Result :: [AddressType] -> Text -> [AddressComponent] -> Maybe [PostcodeLocality] -> Geometry -> Maybe Bool -> PlaceId -> Result
[types] :: Result -> [AddressType]
[formatted_address] :: Result -> Text
[address_components] :: Result -> [AddressComponent]
[postcode_localities] :: Result -> Maybe [PostcodeLocality]
[geometry] :: Result -> Geometry
[partial_match] :: Result -> Maybe Bool
[place_id] :: Result -> PlaceId
-- | Address (and address component) type: The list of types provided by
-- Google (as at 4 March 2017) is incomplete.
data AddressType
AddressType :: Text -> AddressType
-- | Address component
data AddressComponent
AddressComponent :: [AddressType] -> Text -> Text -> AddressComponent
[address_component_types] :: AddressComponent -> [AddressType]
[long_name] :: AddressComponent -> Text
[short_name] :: AddressComponent -> Text
-- | Postcode locality: a locality contained in a postal code.
newtype PostcodeLocality
PostcodeLocality :: Text -> PostcodeLocality
-- | Geometry
data Geometry
Geometry :: Location -> LocationType -> Viewport -> Maybe Viewport -> Geometry
[location] :: Geometry -> Location
[location_type] :: Geometry -> LocationType
[viewport] :: Geometry -> Viewport
[bounds] :: Geometry -> Maybe Viewport
-- | Place id
newtype PlaceId
PlaceId :: Text -> PlaceId
-- | Location
data Location
Location :: Double -> Double -> Location
[lat] :: Location -> Double
[lng] :: Location -> Double
-- | Location type
data LocationType
Rooftop :: LocationType
RangeInterpolated :: LocationType
GeometricCenter :: LocationType
Approximate :: LocationType
-- | Viewport
data Viewport
Viewport :: Location -> Location -> Viewport
[southwest] :: Viewport -> Location
[northeast] :: Viewport -> Location
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.GeocodingResponse
instance GHC.Show.Show Web.Google.Maps.Geocoding.GeocodingResponse
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.GeocodingResponse
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.Result
instance GHC.Show.Show Web.Google.Maps.Geocoding.Result
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Result
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.PlaceId
instance GHC.Show.Show Web.Google.Maps.Geocoding.PlaceId
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.PlaceId
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.Geometry
instance GHC.Show.Show Web.Google.Maps.Geocoding.Geometry
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Geometry
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.Viewport
instance GHC.Show.Show Web.Google.Maps.Geocoding.Viewport
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Viewport
instance GHC.Show.Show Web.Google.Maps.Geocoding.LocationType
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.LocationType
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.Location
instance GHC.Show.Show Web.Google.Maps.Geocoding.Location
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Location
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.PostcodeLocality
instance GHC.Show.Show Web.Google.Maps.Geocoding.PostcodeLocality
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.PostcodeLocality
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.AddressComponent
instance GHC.Show.Show Web.Google.Maps.Geocoding.AddressComponent
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.AddressComponent
instance GHC.Generics.Generic Web.Google.Maps.Geocoding.AddressType
instance GHC.Show.Show Web.Google.Maps.Geocoding.AddressType
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.AddressType
instance GHC.Show.Show Web.Google.Maps.Geocoding.Status
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Status
instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.Address
instance GHC.Show.Show Web.Google.Maps.Geocoding.Address
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Address
instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.Key
instance GHC.Show.Show Web.Google.Maps.Geocoding.Key
instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Key
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.GeocodingResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.Status
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.Result
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.AddressType
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.AddressComponent
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.PostcodeLocality
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.Geometry
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.Location
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.LocationType
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.Viewport
instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Geocoding.PlaceId