-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings to the Google Static Maps API -- -- The Google Static Maps API returns a map as an image via an -- HTTP request. This library provides bindings in Haskell to that API. -- -- NB: The use of the Google Static Maps API services is subject to the -- Google Maps APIs Terms of Service, which terms restrict the use -- of content. -- -- This package has no connection with Google Inc. or its affiliates. @package google-static-maps @version 0.1.0.0 -- | This module has no connection with Google Inc. or its affiliates. -- -- The Google Static Maps API returns a map as an image via an -- HTTP request. This library provides bindings in Haskell to that API. -- -- NB: The use of the Google Static Maps API services is subject to the -- Google Maps APIs Terms of Service, which terms restrict the use -- of content. -- -- The following are not yet implemented: certain optional parameters -- (language, region and signature); address -- locations; non-PNG image formats; custom marker icons; and encoded -- polyline paths. -- -- The code below is an example console application to test the use of -- the library with the Google Static Maps API. -- --
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   module Main (main) where
--   
--   import Codec.Picture.Saving (imageToPng)               -- package JuicyPixels
--   import qualified Data.ByteString.Lazy as B (writeFile)
--   import Data.Maybe (fromJust)
--   import Graphics.Gloss (Display (..), display, white)   -- package gloss
--   import Graphics.Gloss.Juicy (fromDynamicImage)         -- package gloss-juicy
--   import Network.HTTP.Client (newManager)
--   import Network.HTTP.Client.TLS (tlsManagerSettings)
--   import Web.Google.Static.Maps (Center (..), Key (..), Location (..), Size (..),
--       staticmap, StaticmapResponse (..), Zoom (..))
--   
--   main :: IO ()
--   main = do
--       putStrLn "A test of the Google Static Maps 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"
--       mgr <- newManager tlsManagerSettings
--       let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>"
--           center = Just $ Center (Location 42.165950 (-71.362015))
--           zoom   = Just $ Zoom 17
--           w      = 400
--           h      = 400
--           size   = Size w h
--       result <- staticmap mgr apiKey center zoom size Nothing Nothing []
--                     Nothing [] [] Nothing
--       case result of
--           Right response -> do
--               let picture = fromJust $ fromDynamicImage response
--                   title   = "Test Google Static Maps API"
--                   window  = InWindow title (w, h) (10, 10)
--               display window white picture 
--           Left err -> putStrLn $ "Error! Result:\n" ++ show err
--   
module Web.Google.Static.Maps -- | Retrieve a static map. NB: The use of the Google Static Maps API -- services is subject to the Google Maps APIs Terms of Service. staticmap :: Manager -> Key -> Maybe Center -> Maybe Zoom -> Size -> Maybe Scale -> Maybe Format -> [MapStyle] -> Maybe MapType -> [Markers] -> [Path] -> Maybe Visible -> IO (Either ServantError StaticmapResponse) -- | Google Static Maps API type GoogleStaticMapsAPI = QueryParam "key" Key :> (QueryParam "center" Center :> (QueryParam "zoom" Zoom :> (QueryParam "size" Size :> (QueryParam "scale" Scale :> (QueryParam "format" Format :> (QueryParams "style" MapStyle :> (QueryParam "maptype" MapType :> (QueryParams "markers" Markers :> (QueryParams "path" Path :> (QueryParam "visible" Visible :> Get '[PNG] StaticmapResponse)))))))))) -- | API type api :: Proxy GoogleStaticMapsAPI -- | API key newtype Key Key :: Text -> Key -- | Center of the map: not required if the map includes markers or paths. newtype Center Center :: Location -> Center -- | Location data Location Location :: Double -> Double -> Location -- | Takes any value between -90 and 90. [lat] :: Location -> Double -- | Takes any value between -180 and 180. [lng] :: Location -> Double -- | Zoom level: the lowest level, in which the whole world can be seen, is -- 0. Each succeeding level doubles the precision. Not required if the -- map includes markers or paths. newtype Zoom Zoom :: Int -> Zoom -- | Size in pixels: there are maximum allowable values. data Size Size :: Int -> Int -> Size [width] :: Size -> Int [height] :: Size -> Int -- | Scale data Scale -- | The default value. Single :: Scale Double :: Scale Quadruple :: Scale -- | Image format data Format -- | The default value. Png8 :: Format Png32 :: Format -- | Map type data MapType -- | The default value. RoadMap :: MapType Satellite :: MapType Hybrid :: MapType Terrain :: MapType -- | MapStyle data MapStyle MapStyle :: (Maybe Feature) -> (Maybe Element) -> [MapStyleOp] -> MapStyle -- | Map feature data Feature AllFeatures :: Feature Administrative :: Feature AdministrativeCountry :: Feature AdministrativeLandParcel :: Feature AdministrativeLocality :: Feature AdministrativeNeighborhood :: Feature AdministrativeProvince :: Feature Landscape :: Feature LandscapeManMade :: Feature LandscapeNatural :: Feature LandscapeNaturalLandcover :: Feature LandscapeNaturalTerrain :: Feature Poi :: Feature PoiAttraction :: Feature PoiBusiness :: Feature PoiGovernment :: Feature PoiMedical :: Feature PoiPark :: Feature PoiPlaceOfWorship :: Feature PoiSchool :: Feature PoiSportsComplex :: Feature Road :: Feature RoadArterial :: Feature RoadHighway :: Feature RoadHighwayControlledAccess :: Feature RoadLocal :: Feature Transit :: Feature TransitLine :: Feature TransitStation :: Feature TransitStationAirport :: Feature TransitStationBus :: Feature TransitStationRail :: Feature Water :: Feature -- | Feature element data Element AllElements :: Element Geometry :: Element GeometryFill :: Element GeometryStroke :: Element Labels :: Element LabelsIcon :: Element LabelsText :: Element LabelsTextFill :: Element LabelsTextStroke :: Element -- | Map style operation data MapStyleOp StyleHue :: Word8 -> Word8 -> Word8 -> MapStyleOp StyleLightness :: Double -> MapStyleOp StyleSaturation :: Double -> MapStyleOp StyleGamma :: Double -> MapStyleOp StyleInvertLightness :: Bool -> MapStyleOp StyleVisibility :: Visibility -> MapStyleOp StyleColor :: Word8 -> Word8 -> Word8 -> MapStyleOp StyleWeight :: Int -> MapStyleOp -- | Visibility data Visibility On :: Visibility Off :: Visibility -- | Removes some, not all, style features Simplified :: Visibility -- | Markers data Markers Markers :: (Maybe MarkerStyle) -> [Location] -> Markers -- | Marker style data MarkerStyle MarkerStyle :: Maybe MarkerSize -> Maybe MarkerColor -> Maybe MarkerLabel -> MarkerStyle [markerSize] :: MarkerStyle -> Maybe MarkerSize [markerColor] :: MarkerStyle -> Maybe MarkerColor [markerLabel] :: MarkerStyle -> Maybe MarkerLabel -- | Marker size data MarkerSize Tiny :: MarkerSize Mid :: MarkerSize Small :: MarkerSize -- | Marker colour data MarkerColor MarkerColor :: Word8 -> Word8 -> Word8 -> MarkerColor StdMarkerColor :: StdColor -> MarkerColor -- | Marker label character newtype MarkerLabel MarkerLabel :: Char -> MarkerLabel -- | Standard colours data StdColor Black :: StdColor Brown :: StdColor Green :: StdColor Purple :: StdColor Yellow :: StdColor Blue :: StdColor Gray :: StdColor Orange :: StdColor Red :: StdColor White :: StdColor -- | Path data Path Path :: (Maybe PathStyle) -> [Location] -> Path -- | Path style: a geodesic path follows the curvature of the Earth. data PathStyle PathStyle :: Maybe PathWeight -> Maybe PathColor -> Maybe PathColor -> Maybe PathGeodesic -> PathStyle -- | The default value is 5. [pathWeight] :: PathStyle -> Maybe PathWeight [pathColor] :: PathStyle -> Maybe PathColor [pathFillColor] :: PathStyle -> Maybe PathColor -- | The default value is false. [pathGeodesic] :: PathStyle -> Maybe PathGeodesic -- | Path weight: in pixels. newtype PathWeight PathWeight :: Int -> PathWeight -- | Path colour data PathColor PathColor :: Word8 -> Word8 -> Word8 -> PathColor PathColorAlpha :: Word8 -> Word8 -> Word8 -> Word8 -> PathColor StdPathColor :: StdColor -> PathColor -- | Path is geodesic newtype PathGeodesic PathGeodesic :: Bool -> PathGeodesic -- | Visible locations newtype Visible Visible :: [Location] -> Visible -- | StaticmapResponse type StaticmapResponse = DynamicImage instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Visible instance GHC.Show.Show Web.Google.Static.Maps.Visible instance GHC.Classes.Eq Web.Google.Static.Maps.Visible instance GHC.Show.Show Web.Google.Static.Maps.Path instance GHC.Classes.Eq Web.Google.Static.Maps.Path instance GHC.Show.Show Web.Google.Static.Maps.PathStyle instance GHC.Classes.Eq Web.Google.Static.Maps.PathStyle instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.PathGeodesic instance GHC.Show.Show Web.Google.Static.Maps.PathGeodesic instance GHC.Classes.Eq Web.Google.Static.Maps.PathGeodesic instance GHC.Classes.Eq Web.Google.Static.Maps.PathColor instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.PathWeight instance GHC.Show.Show Web.Google.Static.Maps.PathWeight instance GHC.Classes.Eq Web.Google.Static.Maps.PathWeight instance GHC.Show.Show Web.Google.Static.Maps.Markers instance GHC.Classes.Eq Web.Google.Static.Maps.Markers instance GHC.Show.Show Web.Google.Static.Maps.MarkerStyle instance GHC.Classes.Eq Web.Google.Static.Maps.MarkerStyle instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MarkerLabel instance GHC.Show.Show Web.Google.Static.Maps.MarkerLabel instance GHC.Classes.Eq Web.Google.Static.Maps.MarkerLabel instance GHC.Classes.Eq Web.Google.Static.Maps.MarkerColor instance GHC.Classes.Eq Web.Google.Static.Maps.StdColor instance GHC.Show.Show Web.Google.Static.Maps.MarkerSize instance GHC.Classes.Eq Web.Google.Static.Maps.MarkerSize instance GHC.Show.Show Web.Google.Static.Maps.MapStyle instance GHC.Classes.Eq Web.Google.Static.Maps.MapStyle instance GHC.Show.Show Web.Google.Static.Maps.MapStyleOp instance GHC.Classes.Eq Web.Google.Static.Maps.MapStyleOp instance GHC.Classes.Eq Web.Google.Static.Maps.Visibility instance GHC.Classes.Eq Web.Google.Static.Maps.Element instance GHC.Classes.Eq Web.Google.Static.Maps.Feature instance GHC.Show.Show Web.Google.Static.Maps.MapType instance GHC.Classes.Eq Web.Google.Static.Maps.MapType instance GHC.Show.Show Web.Google.Static.Maps.Format instance GHC.Classes.Eq Web.Google.Static.Maps.Format instance GHC.Show.Show Web.Google.Static.Maps.Scale instance GHC.Classes.Eq Web.Google.Static.Maps.Scale instance GHC.Show.Show Web.Google.Static.Maps.Size instance GHC.Classes.Eq Web.Google.Static.Maps.Size instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Zoom instance GHC.Show.Show Web.Google.Static.Maps.Zoom instance GHC.Classes.Eq Web.Google.Static.Maps.Zoom instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Center instance GHC.Show.Show Web.Google.Static.Maps.Center instance GHC.Classes.Eq Web.Google.Static.Maps.Center instance GHC.Show.Show Web.Google.Static.Maps.Location instance GHC.Classes.Eq Web.Google.Static.Maps.Location instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Key instance GHC.Show.Show Web.Google.Static.Maps.Key instance GHC.Classes.Eq Web.Google.Static.Maps.Key instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Location instance Web.Internal.HttpApiData.ToHttpApiData [Web.Google.Static.Maps.Location] instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Size instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Scale instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Format instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MapType instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MapStyle instance GHC.Show.Show Web.Google.Static.Maps.Feature instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Feature instance GHC.Show.Show Web.Google.Static.Maps.Element instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Element instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MapStyleOp instance Web.Internal.HttpApiData.ToHttpApiData [Web.Google.Static.Maps.MapStyleOp] instance GHC.Show.Show Web.Google.Static.Maps.Visibility instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Visibility instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Markers instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MarkerStyle instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MarkerSize instance GHC.Show.Show Web.Google.Static.Maps.MarkerColor instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.MarkerColor instance GHC.Show.Show Web.Google.Static.Maps.StdColor instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.Path instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.PathStyle instance GHC.Show.Show Web.Google.Static.Maps.PathColor instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Static.Maps.PathColor