google-maps-geocoding 0.2.0.0 → 0.3.0.0
raw patch · 3 files changed
+140/−32 lines, 3 filesdep ~google-static-mapsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: google-static-maps
API changes (from Hackage documentation)
- Web.Google.Maps.Geocoding: Location :: Double -> Double -> Location
- Web.Google.Maps.Geocoding: data AddressType
- Web.Google.Maps.Geocoding: instance GHC.Classes.Eq Web.Google.Maps.Geocoding.Address
- Web.Google.Maps.Geocoding: instance GHC.Show.Show Web.Google.Maps.Geocoding.Address
- Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.Address
+ Web.Google.Maps.Geocoding: AC :: Region
+ Web.Google.Maps.Geocoding: AD :: Region
+ Web.Google.Maps.Geocoding: AE :: Region
+ Web.Google.Maps.Geocoding: AF :: Region
+ Web.Google.Maps.Geocoding: AG :: Region
+ Web.Google.Maps.Geocoding: AI :: Region
+ Web.Google.Maps.Geocoding: AL :: Region
+ Web.Google.Maps.Geocoding: AM :: Region
+ Web.Google.Maps.Geocoding: AO :: Region
+ Web.Google.Maps.Geocoding: AQ :: Region
+ Web.Google.Maps.Geocoding: AR :: Region
+ Web.Google.Maps.Geocoding: AS :: Region
+ Web.Google.Maps.Geocoding: AT :: Region
+ Web.Google.Maps.Geocoding: AU :: Region
+ Web.Google.Maps.Geocoding: AW :: Region
+ Web.Google.Maps.Geocoding: AX :: Region
+ Web.Google.Maps.Geocoding: AZ :: Region
+ Web.Google.Maps.Geocoding: AdministrativeArea :: Text -> FilterComponent
+ Web.Google.Maps.Geocoding: Arabic :: Language
+ Web.Google.Maps.Geocoding: BA :: Region
+ Web.Google.Maps.Geocoding: BB :: Region
+ Web.Google.Maps.Geocoding: BD :: Region
+ Web.Google.Maps.Geocoding: BE :: Region
+ Web.Google.Maps.Geocoding: BF :: Region
+ Web.Google.Maps.Geocoding: BG :: Region
+ Web.Google.Maps.Geocoding: BH :: Region
+ Web.Google.Maps.Geocoding: BI :: Region
+ Web.Google.Maps.Geocoding: BJ :: Region
+ Web.Google.Maps.Geocoding: BL :: Region
+ Web.Google.Maps.Geocoding: BM :: Region
+ Web.Google.Maps.Geocoding: BN :: Region
+ Web.Google.Maps.Geocoding: BO :: Region
+ Web.Google.Maps.Geocoding: BQ :: Region
+ Web.Google.Maps.Geocoding: BR :: Region
+ Web.Google.Maps.Geocoding: BS :: Region
+ Web.Google.Maps.Geocoding: BT :: Region
+ Web.Google.Maps.Geocoding: BV :: Region
+ Web.Google.Maps.Geocoding: BW :: Region
+ Web.Google.Maps.Geocoding: BY :: Region
+ Web.Google.Maps.Geocoding: BZ :: Region
+ Web.Google.Maps.Geocoding: Basque :: Language
+ Web.Google.Maps.Geocoding: Bengali :: Language
+ Web.Google.Maps.Geocoding: Bulgarian :: Language
+ Web.Google.Maps.Geocoding: CA :: Region
+ Web.Google.Maps.Geocoding: CC :: Region
+ Web.Google.Maps.Geocoding: CD :: Region
+ Web.Google.Maps.Geocoding: CF :: Region
+ Web.Google.Maps.Geocoding: CG :: Region
+ Web.Google.Maps.Geocoding: CH :: Region
+ Web.Google.Maps.Geocoding: CI :: Region
+ Web.Google.Maps.Geocoding: CK :: Region
+ Web.Google.Maps.Geocoding: CL :: Region
+ Web.Google.Maps.Geocoding: CM :: Region
+ Web.Google.Maps.Geocoding: CN :: Region
+ Web.Google.Maps.Geocoding: CO :: Region
+ Web.Google.Maps.Geocoding: CR :: Region
+ Web.Google.Maps.Geocoding: CU :: Region
+ Web.Google.Maps.Geocoding: CV :: Region
+ Web.Google.Maps.Geocoding: CW :: Region
+ Web.Google.Maps.Geocoding: CX :: Region
+ Web.Google.Maps.Geocoding: CY :: Region
+ Web.Google.Maps.Geocoding: CZ :: Region
+ Web.Google.Maps.Geocoding: Catalan :: Language
+ Web.Google.Maps.Geocoding: ChineseSimplified :: Language
+ Web.Google.Maps.Geocoding: ChineseTraditional :: Language
+ Web.Google.Maps.Geocoding: Coords :: LatLng -> Location
+ Web.Google.Maps.Geocoding: Country :: Region -> FilterComponent
+ Web.Google.Maps.Geocoding: Croatian :: Language
+ Web.Google.Maps.Geocoding: Czech :: Language
+ Web.Google.Maps.Geocoding: DE :: Region
+ Web.Google.Maps.Geocoding: DJ :: Region
+ Web.Google.Maps.Geocoding: DK :: Region
+ Web.Google.Maps.Geocoding: DM :: Region
+ Web.Google.Maps.Geocoding: DO :: Region
+ Web.Google.Maps.Geocoding: DZ :: Region
+ Web.Google.Maps.Geocoding: Danish :: Language
+ Web.Google.Maps.Geocoding: Dutch :: Language
+ Web.Google.Maps.Geocoding: EC :: Region
+ Web.Google.Maps.Geocoding: EE :: Region
+ Web.Google.Maps.Geocoding: EG :: Region
+ Web.Google.Maps.Geocoding: EH :: Region
+ Web.Google.Maps.Geocoding: ER :: Region
+ Web.Google.Maps.Geocoding: ES :: Region
+ Web.Google.Maps.Geocoding: ET :: Region
+ Web.Google.Maps.Geocoding: EU :: Region
+ Web.Google.Maps.Geocoding: English :: Language
+ Web.Google.Maps.Geocoding: EnglishAustralian :: Language
+ Web.Google.Maps.Geocoding: EnglishBritish :: Language
+ Web.Google.Maps.Geocoding: FI :: Region
+ Web.Google.Maps.Geocoding: FJ :: Region
+ Web.Google.Maps.Geocoding: FK :: Region
+ Web.Google.Maps.Geocoding: FM :: Region
+ Web.Google.Maps.Geocoding: FO :: Region
+ Web.Google.Maps.Geocoding: FR :: Region
+ Web.Google.Maps.Geocoding: Farsi :: Language
+ Web.Google.Maps.Geocoding: Filipino :: Language
+ Web.Google.Maps.Geocoding: Finnish :: Language
+ Web.Google.Maps.Geocoding: French :: Language
+ Web.Google.Maps.Geocoding: GA :: Region
+ Web.Google.Maps.Geocoding: GB :: Region
+ Web.Google.Maps.Geocoding: GD :: Region
+ Web.Google.Maps.Geocoding: GE :: Region
+ Web.Google.Maps.Geocoding: GF :: Region
+ Web.Google.Maps.Geocoding: GG :: Region
+ Web.Google.Maps.Geocoding: GH :: Region
+ Web.Google.Maps.Geocoding: GI :: Region
+ Web.Google.Maps.Geocoding: GL :: Region
+ Web.Google.Maps.Geocoding: GM :: Region
+ Web.Google.Maps.Geocoding: GN :: Region
+ Web.Google.Maps.Geocoding: GP :: Region
+ Web.Google.Maps.Geocoding: GQ :: Region
+ Web.Google.Maps.Geocoding: GR :: Region
+ Web.Google.Maps.Geocoding: GS :: Region
+ Web.Google.Maps.Geocoding: GT :: Region
+ Web.Google.Maps.Geocoding: GU :: Region
+ Web.Google.Maps.Geocoding: GW :: Region
+ Web.Google.Maps.Geocoding: GY :: Region
+ Web.Google.Maps.Geocoding: Galician :: Language
+ Web.Google.Maps.Geocoding: German :: Language
+ Web.Google.Maps.Geocoding: Greek :: Language
+ Web.Google.Maps.Geocoding: Gujarati :: Language
+ Web.Google.Maps.Geocoding: HK :: Region
+ Web.Google.Maps.Geocoding: HM :: Region
+ Web.Google.Maps.Geocoding: HN :: Region
+ Web.Google.Maps.Geocoding: HR :: Region
+ Web.Google.Maps.Geocoding: HT :: Region
+ Web.Google.Maps.Geocoding: HU :: Region
+ Web.Google.Maps.Geocoding: Hebrew :: Language
+ Web.Google.Maps.Geocoding: Hindi :: Language
+ Web.Google.Maps.Geocoding: Hungarian :: Language
+ Web.Google.Maps.Geocoding: ID :: Region
+ Web.Google.Maps.Geocoding: IE :: Region
+ Web.Google.Maps.Geocoding: IL :: Region
+ Web.Google.Maps.Geocoding: IM :: Region
+ Web.Google.Maps.Geocoding: IN :: Region
+ Web.Google.Maps.Geocoding: IO :: Region
+ Web.Google.Maps.Geocoding: IQ :: Region
+ Web.Google.Maps.Geocoding: IR :: Region
+ Web.Google.Maps.Geocoding: IS :: Region
+ Web.Google.Maps.Geocoding: IT :: Region
+ Web.Google.Maps.Geocoding: Indonesian :: Language
+ Web.Google.Maps.Geocoding: Italian :: Language
+ Web.Google.Maps.Geocoding: JE :: Region
+ Web.Google.Maps.Geocoding: JM :: Region
+ Web.Google.Maps.Geocoding: JO :: Region
+ Web.Google.Maps.Geocoding: JP :: Region
+ Web.Google.Maps.Geocoding: Japanese :: Language
+ Web.Google.Maps.Geocoding: KE :: Region
+ Web.Google.Maps.Geocoding: KG :: Region
+ Web.Google.Maps.Geocoding: KH :: Region
+ Web.Google.Maps.Geocoding: KI :: Region
+ Web.Google.Maps.Geocoding: KM :: Region
+ Web.Google.Maps.Geocoding: KN :: Region
+ Web.Google.Maps.Geocoding: KP :: Region
+ Web.Google.Maps.Geocoding: KR :: Region
+ Web.Google.Maps.Geocoding: KW :: Region
+ Web.Google.Maps.Geocoding: KY :: Region
+ Web.Google.Maps.Geocoding: KZ :: Region
+ Web.Google.Maps.Geocoding: Kannada :: Language
+ Web.Google.Maps.Geocoding: Korean :: Language
+ Web.Google.Maps.Geocoding: LA :: Region
+ Web.Google.Maps.Geocoding: LB :: Region
+ Web.Google.Maps.Geocoding: LC :: Region
+ Web.Google.Maps.Geocoding: LI :: Region
+ Web.Google.Maps.Geocoding: LK :: Region
+ Web.Google.Maps.Geocoding: LR :: Region
+ Web.Google.Maps.Geocoding: LS :: Region
+ Web.Google.Maps.Geocoding: LT :: Region
+ Web.Google.Maps.Geocoding: LU :: Region
+ Web.Google.Maps.Geocoding: LV :: Region
+ Web.Google.Maps.Geocoding: LY :: Region
+ Web.Google.Maps.Geocoding: LatLng :: Double -> Double -> LatLng
+ Web.Google.Maps.Geocoding: Latvian :: Language
+ Web.Google.Maps.Geocoding: Lithuanian :: Language
+ Web.Google.Maps.Geocoding: Locale :: Address -> Location
+ Web.Google.Maps.Geocoding: Locality :: Text -> FilterComponent
+ Web.Google.Maps.Geocoding: MA :: Region
+ Web.Google.Maps.Geocoding: MC :: Region
+ Web.Google.Maps.Geocoding: MD :: Region
+ Web.Google.Maps.Geocoding: ME :: Region
+ Web.Google.Maps.Geocoding: MF :: Region
+ Web.Google.Maps.Geocoding: MG :: Region
+ Web.Google.Maps.Geocoding: MH :: Region
+ Web.Google.Maps.Geocoding: MK :: Region
+ Web.Google.Maps.Geocoding: ML :: Region
+ Web.Google.Maps.Geocoding: MM :: Region
+ Web.Google.Maps.Geocoding: MN :: Region
+ Web.Google.Maps.Geocoding: MO :: Region
+ Web.Google.Maps.Geocoding: MP :: Region
+ Web.Google.Maps.Geocoding: MQ :: Region
+ Web.Google.Maps.Geocoding: MR :: Region
+ Web.Google.Maps.Geocoding: MS :: Region
+ Web.Google.Maps.Geocoding: MT :: Region
+ Web.Google.Maps.Geocoding: MU :: Region
+ Web.Google.Maps.Geocoding: MV :: Region
+ Web.Google.Maps.Geocoding: MW :: Region
+ Web.Google.Maps.Geocoding: MX :: Region
+ Web.Google.Maps.Geocoding: MY :: Region
+ Web.Google.Maps.Geocoding: MZ :: Region
+ Web.Google.Maps.Geocoding: Malayalam :: Language
+ Web.Google.Maps.Geocoding: Marathi :: Language
+ Web.Google.Maps.Geocoding: NA :: Region
+ Web.Google.Maps.Geocoding: NC :: Region
+ Web.Google.Maps.Geocoding: NE :: Region
+ Web.Google.Maps.Geocoding: NF :: Region
+ Web.Google.Maps.Geocoding: NG :: Region
+ Web.Google.Maps.Geocoding: NI :: Region
+ Web.Google.Maps.Geocoding: NL :: Region
+ Web.Google.Maps.Geocoding: NO :: Region
+ Web.Google.Maps.Geocoding: NP :: Region
+ Web.Google.Maps.Geocoding: NR :: Region
+ Web.Google.Maps.Geocoding: NU :: Region
+ Web.Google.Maps.Geocoding: NZ :: Region
+ Web.Google.Maps.Geocoding: Norwegian :: Language
+ Web.Google.Maps.Geocoding: OM :: Region
+ Web.Google.Maps.Geocoding: PA :: Region
+ Web.Google.Maps.Geocoding: PE :: Region
+ Web.Google.Maps.Geocoding: PF :: Region
+ Web.Google.Maps.Geocoding: PG :: Region
+ Web.Google.Maps.Geocoding: PH :: Region
+ Web.Google.Maps.Geocoding: PK :: Region
+ Web.Google.Maps.Geocoding: PL :: Region
+ Web.Google.Maps.Geocoding: PM :: Region
+ Web.Google.Maps.Geocoding: PN :: Region
+ Web.Google.Maps.Geocoding: PR :: Region
+ Web.Google.Maps.Geocoding: PS :: Region
+ Web.Google.Maps.Geocoding: PT :: Region
+ Web.Google.Maps.Geocoding: PW :: Region
+ Web.Google.Maps.Geocoding: PY :: Region
+ Web.Google.Maps.Geocoding: Polish :: Language
+ Web.Google.Maps.Geocoding: Portuguese :: Language
+ Web.Google.Maps.Geocoding: PortugueseBrazil :: Language
+ Web.Google.Maps.Geocoding: PortuguesePortugal :: Language
+ Web.Google.Maps.Geocoding: PostalCode :: Text -> FilterComponent
+ Web.Google.Maps.Geocoding: QA :: Region
+ Web.Google.Maps.Geocoding: RE :: Region
+ Web.Google.Maps.Geocoding: RO :: Region
+ Web.Google.Maps.Geocoding: RS :: Region
+ Web.Google.Maps.Geocoding: RU :: Region
+ Web.Google.Maps.Geocoding: RW :: Region
+ Web.Google.Maps.Geocoding: Romanian :: Language
+ Web.Google.Maps.Geocoding: Route :: Text -> FilterComponent
+ Web.Google.Maps.Geocoding: Russian :: Language
+ Web.Google.Maps.Geocoding: SA :: Region
+ Web.Google.Maps.Geocoding: SB :: Region
+ Web.Google.Maps.Geocoding: SC :: Region
+ Web.Google.Maps.Geocoding: SD :: Region
+ Web.Google.Maps.Geocoding: SE :: Region
+ Web.Google.Maps.Geocoding: SG :: Region
+ Web.Google.Maps.Geocoding: SH :: Region
+ Web.Google.Maps.Geocoding: SI :: Region
+ Web.Google.Maps.Geocoding: SJ :: Region
+ Web.Google.Maps.Geocoding: SK :: Region
+ Web.Google.Maps.Geocoding: SL :: Region
+ Web.Google.Maps.Geocoding: SM :: Region
+ Web.Google.Maps.Geocoding: SN :: Region
+ Web.Google.Maps.Geocoding: SO :: Region
+ Web.Google.Maps.Geocoding: SR :: Region
+ Web.Google.Maps.Geocoding: SS :: Region
+ Web.Google.Maps.Geocoding: ST :: Region
+ Web.Google.Maps.Geocoding: SV :: Region
+ Web.Google.Maps.Geocoding: SX :: Region
+ Web.Google.Maps.Geocoding: SY :: Region
+ Web.Google.Maps.Geocoding: SZ :: Region
+ Web.Google.Maps.Geocoding: Serbian :: Language
+ Web.Google.Maps.Geocoding: Slovak :: Language
+ Web.Google.Maps.Geocoding: Slovenian :: Language
+ Web.Google.Maps.Geocoding: Spanish :: Language
+ Web.Google.Maps.Geocoding: Swedish :: Language
+ Web.Google.Maps.Geocoding: TC :: Region
+ Web.Google.Maps.Geocoding: TD :: Region
+ Web.Google.Maps.Geocoding: TF :: Region
+ Web.Google.Maps.Geocoding: TG :: Region
+ Web.Google.Maps.Geocoding: TH :: Region
+ Web.Google.Maps.Geocoding: TJ :: Region
+ Web.Google.Maps.Geocoding: TK :: Region
+ Web.Google.Maps.Geocoding: TL :: Region
+ Web.Google.Maps.Geocoding: TM :: Region
+ Web.Google.Maps.Geocoding: TN :: Region
+ Web.Google.Maps.Geocoding: TO :: Region
+ Web.Google.Maps.Geocoding: TR :: Region
+ Web.Google.Maps.Geocoding: TT :: Region
+ Web.Google.Maps.Geocoding: TV :: Region
+ Web.Google.Maps.Geocoding: TW :: Region
+ Web.Google.Maps.Geocoding: TZ :: Region
+ Web.Google.Maps.Geocoding: Tagalog :: Language
+ Web.Google.Maps.Geocoding: Tamil :: Language
+ Web.Google.Maps.Geocoding: Telugu :: Language
+ Web.Google.Maps.Geocoding: Thai :: Language
+ Web.Google.Maps.Geocoding: Turkish :: Language
+ Web.Google.Maps.Geocoding: UA :: Region
+ Web.Google.Maps.Geocoding: UG :: Region
+ Web.Google.Maps.Geocoding: UK :: Region
+ Web.Google.Maps.Geocoding: UM :: Region
+ Web.Google.Maps.Geocoding: US :: Region
+ Web.Google.Maps.Geocoding: UY :: Region
+ Web.Google.Maps.Geocoding: UZ :: Region
+ Web.Google.Maps.Geocoding: Ukrainian :: Language
+ Web.Google.Maps.Geocoding: VA :: Region
+ Web.Google.Maps.Geocoding: VC :: Region
+ Web.Google.Maps.Geocoding: VE :: Region
+ Web.Google.Maps.Geocoding: VG :: Region
+ Web.Google.Maps.Geocoding: VI :: Region
+ Web.Google.Maps.Geocoding: VN :: Region
+ Web.Google.Maps.Geocoding: VU :: Region
+ Web.Google.Maps.Geocoding: Vietnamese :: Language
+ Web.Google.Maps.Geocoding: WF :: Region
+ Web.Google.Maps.Geocoding: WS :: Region
+ Web.Google.Maps.Geocoding: YE :: Region
+ Web.Google.Maps.Geocoding: YT :: Region
+ Web.Google.Maps.Geocoding: ZA :: Region
+ Web.Google.Maps.Geocoding: ZM :: Region
+ Web.Google.Maps.Geocoding: ZW :: Region
+ Web.Google.Maps.Geocoding: backGeocode :: Manager -> Key -> Maybe LatLng -> Maybe PlaceId -> Maybe AddressType -> Maybe LocationType -> Maybe Language -> IO (Either ServantError GeocodingResponse)
+ Web.Google.Maps.Geocoding: data FilterComponent
+ Web.Google.Maps.Geocoding: data Language :: *
+ Web.Google.Maps.Geocoding: data LatLng :: *
+ Web.Google.Maps.Geocoding: data Region :: *
+ Web.Google.Maps.Geocoding: instance GHC.Classes.Eq Web.Google.Maps.Geocoding.FilterComponent
+ Web.Google.Maps.Geocoding: instance GHC.Show.Show Web.Google.Maps.Geocoding.FilterComponent
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.AddressType
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.FilterComponent
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.LocationType
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.PlaceId
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Geocoding.Viewport
+ Web.Google.Maps.Geocoding: instance Web.Internal.HttpApiData.ToHttpApiData [Web.Google.Maps.Geocoding.FilterComponent]
+ Web.Google.Maps.Geocoding: newtype AddressType
- Web.Google.Maps.Geocoding: Geometry :: Location -> LocationType -> Viewport -> Maybe Viewport -> Geometry
+ Web.Google.Maps.Geocoding: Geometry :: LatLng -> LocationType -> Viewport -> Maybe Viewport -> Geometry
- Web.Google.Maps.Geocoding: Viewport :: Location -> Location -> Viewport
+ Web.Google.Maps.Geocoding: Viewport :: LatLng -> LatLng -> Viewport
- Web.Google.Maps.Geocoding: [lat] :: Location -> Double
+ Web.Google.Maps.Geocoding: [lat] :: LatLng -> Double
- Web.Google.Maps.Geocoding: [lng] :: Location -> Double
+ Web.Google.Maps.Geocoding: [lng] :: LatLng -> Double
- Web.Google.Maps.Geocoding: [location] :: Geometry -> Location
+ Web.Google.Maps.Geocoding: [location] :: Geometry -> LatLng
- Web.Google.Maps.Geocoding: [northeast] :: Viewport -> Location
+ Web.Google.Maps.Geocoding: [northeast] :: Viewport -> LatLng
- Web.Google.Maps.Geocoding: [southwest] :: Viewport -> Location
+ Web.Google.Maps.Geocoding: [southwest] :: Viewport -> LatLng
- Web.Google.Maps.Geocoding: geocode :: Manager -> Key -> Address -> IO (Either ServantError GeocodingResponse)
+ Web.Google.Maps.Geocoding: geocode :: Manager -> Key -> Maybe Address -> Maybe [FilterComponent] -> Maybe Viewport -> Maybe Language -> Maybe Region -> IO (Either ServantError GeocodingResponse)
- Web.Google.Maps.Geocoding: newtype Address
+ Web.Google.Maps.Geocoding: newtype Address :: *
- Web.Google.Maps.Geocoding: type GoogleMapsGeocodingAPI = "geocode" :> ("json" :> (QueryParam "key" Key :> (QueryParam "address" Address :> Get '[JSON] GeocodingResponse)))
+ Web.Google.Maps.Geocoding: type GoogleMapsGeocodingAPI = ("geocode" :> ("json" :> (QueryParam "key" Key :> (QueryParam "address" Address :> (QueryParam "components" [FilterComponent] :> (QueryParam "bounds" Viewport :> (QueryParam "language" Language :> (QueryParam "region" Region :> Get '[JSON] GeocodingResponse)))))))) :<|> ("geocode" :> ("json" :> (QueryParam "key" Key :> (QueryParam "latlng" LatLng :> (QueryParam "place_id" PlaceId :> (QueryParam "result_type" AddressType :> (QueryParam "location_type" LocationType :> (QueryParam "language" Language :> Get '[JSON] GeocodingResponse))))))))
Files
- changelog.md +8/−0
- google-maps-geocoding.cabal +2/−2
- src/Web/Google/Maps/Geocoding.hs +130/−30
changelog.md view
@@ -1,3 +1,11 @@+# 0.3.0.0 + +* Implement reverse (back) geocoding (`backGeocode`) + +* Implement `components`, `bounds`, `language` and `region` optional parameters + +* Change latitude/longitude type to `LatLng` from `Location` + # 0.2.0.0 * Move `geocode` from the end of the base URL to the start of the API type
google-maps-geocoding.cabal view
@@ -1,5 +1,5 @@ name: google-maps-geocoding -version: 0.2.0.0 +version: 0.3.0.0 synopsis: Google Maps Geocoding API bindings description: The <https://developers.google.com/maps/documentation/geocoding/intro Google Maps Geocoding API> provides a direct way to access geocoding and reverse @@ -30,7 +30,7 @@ exposed-modules: Web.Google.Maps.Geocoding build-depends: base >= 4.7 && < 5 , aeson >= 1.0 && < 1.1 - , google-static-maps >= 0.3 && < 0.4 + , google-static-maps >= 0.4 && < 0.5 , http-client >= 0.5 && < 0.6 , servant >= 0.9 && < 0.10 , servant-client >= 0.9 && <0.10
src/Web/Google/Maps/Geocoding.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeOperators #-} @@ -21,9 +22,6 @@ -- <https://developers.google.com/maps/terms 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. -- @@ -39,8 +37,9 @@ -- > import Network.HTTP.Client (Manager, newManager) -- > import Network.HTTP.Client.TLS (tlsManagerSettings) -- > import Web.Google.Maps.Geocoding (Address (..), geocode, GeocodingResponse (..), --- > Geometry (..), Key (..), Location (..), Result (..), Status (..)) --- > import Web.Google.Static.Maps (Center (..), Size (..), staticmap, Zoom (..)) +-- > Geometry (..), Key (..), LatLng (..), Result (..), Status (..)) +-- > import Web.Google.Static.Maps (Center (..), Location (..), Size (..), +-- > staticmap, Zoom (..)) -- > import System.IO (hFlush, stdout) -- > -- > main :: IO () @@ -51,14 +50,16 @@ -- > txt <- input "Enter full address: " -- > mgr <- newManager tlsManagerSettings -- > let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>" --- > result <- geocode mgr apiKey (Address txt) +-- > result <- geocode mgr apiKey (Just $ Address txt) Nothing Nothing +-- > Nothing Nothing -- > case result of -- > Right response -> do -- > let s = status response -- > case s of -- > OK -> do --- > let center = Center $ location $ geometry $ head $ --- > results response +-- > let latlng = location $ geometry $ head $ results +-- > response +-- > center = Center $ Coord latlng -- > print center -- > displayMap mgr apiKey center -- > _ -> putStrLn $ "Error! Status: " ++ show s @@ -85,12 +86,17 @@ module Web.Google.Maps.Geocoding ( -- * Functions geocode + , backGeocode -- * API , GoogleMapsGeocodingAPI , api -- * Types , Key (..) , Address (..) + , FilterComponent (..) + , Viewport (..) + , Language (..) + , Region (..) , GeocodingResponse (..) , Status (..) , Result (..) @@ -98,27 +104,52 @@ , AddressComponent (..) , PostcodeLocality (..) , Geometry (..) + , LatLng (..) , PlaceId (..) , Location (..) , LocationType (..) - , Viewport (..) ) where import Data.Aeson hiding (Result) import Data.Aeson.Types (Options (..)) +import Data.List (intersperse) import Data.Proxy import Data.Text (Text) -import qualified Data.Text as T (unpack) +import qualified Data.Text as T (concat, unpack) import GHC.Generics (Generic) import Network.HTTP.Client (Manager) import Servant.API import Servant.Client -import Web.Google.Maps.Common (googleMapsApis, Key (..), Location (..)) +import Web.Google.Maps.Common (Address (..), googleMapsApis, Key (..), + Language (..), LatLng (..), Location (..), Region (..)) --- | Address -newtype Address = Address Text - deriving (Eq, Show, ToHttpApiData) +-- | Fliter component: a component that can be used to filter the results +-- returned in a geocoding response. +data FilterComponent + = Route Text + | Locality Text + | AdministrativeArea Text + | PostalCode Text + | Country Region + deriving (Eq, Show) +instance ToHttpApiData FilterComponent where + toUrlPiece filterComponent + | Route route <- filterComponent + = T.concat ["route:", route] + | Locality locality <- filterComponent + = T.concat ["locality:", locality] + | AdministrativeArea adminArea <- filterComponent + = T.concat ["administrative_area:", adminArea] + | PostalCode postalCode <- filterComponent + = T.concat ["postal_code:", postalCode] + | Country country <- filterComponent + = T.concat ["country:", toUrlPiece country] + +instance ToHttpApiData [FilterComponent] where + toUrlPiece [] = "" + toUrlPiece cs = T.concat $ intersperse "|" $ map toUrlPiece cs + -- | Geocoding Reponse data GeocodingResponse = GeocodingResponse { status :: Status @@ -170,8 +201,8 @@ -- | Address (and address component) type: The list of types provided by Google -- (as at 4 March 2017) is incomplete. -data AddressType = AddressType Text - deriving (Eq, Show, Generic) +newtype AddressType = AddressType Text + deriving (Eq, Show, Generic, ToHttpApiData) instance FromJSON AddressType @@ -197,7 +228,7 @@ -- | Geometry data Geometry = Geometry - { location :: Location + { location :: LatLng , location_type :: LocationType , viewport :: Viewport , bounds :: Maybe Viewport @@ -213,6 +244,13 @@ | Approximate deriving (Eq, Show) +instance ToHttpApiData LocationType where + toUrlPiece locationType = case locationType of + Rooftop -> "ROOFTOP" + RangeInterpolated -> "RANGE_INTERPOLATED" + GeometricCenter -> "GEOMETRIC_CENTER" + Approximate -> "APPROXIMATE" + instance FromJSON LocationType where parseJSON = withText "LocationType" $ \t -> case t of "ROOFTOP" -> return Rooftop @@ -223,25 +261,41 @@ -- | Viewport data Viewport = Viewport - { southwest :: Location - , northeast :: Location + { southwest :: LatLng + , northeast :: LatLng } deriving (Eq, Show, Generic) +instance ToHttpApiData Viewport where + toUrlPiece (Viewport sw ne) = T.concat [toUrlPiece sw, "|", toUrlPiece ne] + instance FromJSON Viewport -- | Place id newtype PlaceId = PlaceId Text - deriving (Eq, Show, Generic) + deriving (Eq, Show, Generic, ToHttpApiData) instance FromJSON PlaceId -- | Google Translate API type GoogleMapsGeocodingAPI - = "geocode" - :> "json" - :> QueryParam "key" Key - :> QueryParam "address" Address - :> Get '[JSON] GeocodingResponse + = "geocode" + :> "json" + :> QueryParam "key" Key + :> QueryParam "address" Address + :> QueryParam "components" [FilterComponent] + :> QueryParam "bounds" Viewport + :> QueryParam "language" Language + :> QueryParam "region" Region + :> Get '[JSON] GeocodingResponse + :<|> "geocode" + :> "json" + :> QueryParam "key" Key + :> QueryParam "latlng" LatLng + :> QueryParam "place_id" PlaceId + :> QueryParam "result_type" AddressType + :> QueryParam "location_type" LocationType + :> QueryParam "language" Language + :> Get '[JSON] GeocodingResponse -- | API type api :: Proxy GoogleMapsGeocodingAPI @@ -250,16 +304,62 @@ geocode' :: Maybe Key -> Maybe Address + -> Maybe [FilterComponent] + -> Maybe Viewport + -> Maybe Language + -> Maybe Region -> ClientM GeocodingResponse -geocode' = client api +backGeocode' + :: Maybe Key + -> Maybe LatLng + -> Maybe PlaceId + -> Maybe AddressType + -> Maybe LocationType + -> Maybe Language + -> ClientM GeocodingResponse +geocode' :<|> backGeocode' = client api -- | Geocode. NB: The use of the Google Maps Geocoding API services is subject -- to the <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>. geocode :: Manager -> Key - -> Address + -> Maybe Address + -> Maybe [FilterComponent] + -> Maybe Viewport + -> Maybe Language + -> Maybe Region -> IO (Either ServantError GeocodingResponse) -geocode mgr key address = - runClientM (geocode' (Just key) (Just address)) - (ClientEnv mgr googleMapsApis) +geocode + mgr + key + addressOpt + filterComponentsOpt + viewportOpt + languageOpt + regionOpt + = runClientM (geocode' (Just key) addressOpt filterComponentsOpt viewportOpt + languageOpt regionOpt) (ClientEnv mgr googleMapsApis) + +-- | Reverse (back) geocode. NB: The use of the Google Maps Geocoding API +-- services is subject to the +-- <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>. +backGeocode + :: Manager + -> Key + -> Maybe LatLng + -> Maybe PlaceId + -> Maybe AddressType + -> Maybe LocationType + -> Maybe Language + -> IO (Either ServantError GeocodingResponse) +backGeocode + mgr + key + latLngOpt + placeIdOpt + addressTypeOpt + locationTypeOpt + languageOpt + = runClientM (backGeocode' (Just key) latLngOpt placeIdOpt addressTypeOpt + locationTypeOpt languageOpt) (ClientEnv mgr googleMapsApis)