PaackEng/elm-google-maps/1.0.0

NOTE: the latest version is 2.5.0

GoogleMaps.Polygon

This module allows you to create polygons to be used along with GoogleMaps.Map

import GoogleMaps.Map as Map
import GoogleMaps.Polygon as Polygon


myPolygon : Polygon.Polygon Msg
myPolygon =
    Polygon.init
        [ ( -3.7344654, -38.5057405 )
        , ( -3.7366108, -38.5188557 )
        , ( -3.7374002, -38.5195225 )
        , ( -3.7474947, -38.5153675 )
        ]
        |> Polygon.withStrokeColor "red"
        |> Polygon.withFillColor "orange"
        |> Polygon.withFillOpacity 0.25
        |> Polygon.onClick OnMarkerClicked
        |> Polygon.withClosedMode


mapView : String -> Html Msg
mapView apiKey =
    Map.init apiKey
        |> Map.withPolygons [ myPolygon ]
        |> Map.toHtml

Types

type Polygon msg
type alias Latitude =
Float
type alias Longitude =
Float

Basics

init : List ( Latitude, Latitude ) -> Polygon msg

Modifiers

it forces the polygon to be a closed shape

withFillColor : String -> Polygon msg -> Polygon msg

There is no default color

this function accepts the same formats as the CSS color values

E.g "rbg(255,255,0)", "orange" or "#ff00ff"

withFillOpacity : Float -> Polygon msg -> Polygon msg

The default is 0

withStrokeColor : String -> Polygon msg -> Polygon msg

The default is black

this function accepts the same formats as the CSS color values

E.g "rbg(255,255,0)", "orange" or "#ff00ff"

withStrokeWeight : Int -> Polygon msg -> Polygon msg

The default is 3

withZIndex : Int -> Polygon msg -> Polygon msg

Events

onClick : msg -> Polygon msg -> Polygon msg

Don't touch this :o

toHtml : Polygon msg -> Html msg

You should not use this function, GoogleMaps.Map uses it in order to render the polygon.