getsurance / elm-street / ElmStreet.Place

Types for Google places api

Type aliases


type alias Place =
{ addressComponents : List AddressComponent
, adrAddress : String
, formattedAddress : String
, geometry : Geometry
, icon : String
, id : String
, name : String
, placeId : String
, reference : String
, scope : String
, types : List String
, url : String
, utcOffset : Basics.Int
, vicinity : Maybe String 
}

Type alias for PlaceResult


type alias LatLng =
{ lat : Basics.Float
, lng : Basics.Float 
}

Type alias for LatLng coordinates


type alias LatLngBounds =
{ south : Basics.Float
, west : Basics.Float
, north : Basics.Float
, east : Basics.Float 
}

Type alias for LatLngBouns


type alias AddressComponent =
{ long_name : String
, short_name : String
, types : List ComponentType 
}

Type alias for GeocoderAddressComponent


type alias Geometry =
{ location : LatLng
, viewport : LatLngBounds 
}

Type alias for PlaceGeometry


type ComponentType
    = StreetAddress
    | Route
    | Intersection
    | Political
    | Country
    | AdministrativeAreaLevel1
    | AdministrativeAreaLevel2
    | AdministrativeAreaLevel3
    | AdministrativeAreaLevel4
    | AdministrativeAreaLevel5
    | ColloquialArea
    | Locality
    | Sublocality
    | SublocalityLevel1
    | SublocalityLevel2
    | SublocalityLevel3
    | SublocalityLevel4
    | SublocalityLevel5
    | Neighborhood
    | Premise
    | Subpremise
    | PostalCode
    | NaturalFeature
    | Airport
    | Park
    | PostBox
    | StreetNumber
    | Floor
    | Room
    | Establishment
    | PointOfInterest
    | Parking
    | PostalTown
    | BusStation
    | TrainStation
    | TransitStation
    | PostalCodeSuffix
    | OtherComponent

Types for address component

Decoding

decoder : Json.Decode.Decoder Place

Decoder for objects of type PlaceResult

Helper

getComponentName : Place -> ComponentType -> Maybe String

Helper function to name by components type.