This module allows you to create maps using Google maps webcomponent behind the scene
Note that the map has 100% height, so you would resize the map based on the parent view
import GoogleMaps.Map as Map
mapView : String -> Html Msg
mapView apiKey =
Map.init apiKey
|> Map.toHtmlimport GoogleMaps.Map as Map
mapView : String -> Html Msg
mapView apiKey =
Map.init apiKey
|> Map.withZoom 12
|> Map.withMapType Map.satellite
|> Map.onMapReady MyMsg
|> Map.withCenter -3.7715105 -38.5724269
|> Map.withDefaultUIControls False
|> Map.toHtmlYou can use those functions in order to enable/disable UI controls such as StreetView button, zoom and etc
By default all the controls are enabled
Sets the mapType.
The default type is roadmap.
Possible options:
satellite, roadmap, hybrid, terrain
Example:
import GoogleMaps.Map as Map
mapView : String -> Html Msg
mapView apiKey =
Map.init apiKey
|> Map.withMapType Map.satellite
|> Map.toHtmlSets the center of the map
The idea is make it typed, but right know you should pass the JSON as string
Reference: https://developers.google.com/maps/documentation/javascript/styling
This option is diesabled by default. If the option is enabled the map bounds change in order to fit all the markers. If there is 1 marker only then the map will be centered to the marker position.
import GoogleMaps.Map as Map
import GoogleMaps.Marker as Marker
myMarker : Marker.Marker Msg
myMarker =
Marker.init -3.7344654 -38.5057405
mapView : String -> Html Msg
mapView apiKey =
Map.init apiKey
|> Map.withMarkers [ myMarker ]
|> Map.toHtmlDefault value is 20
Default value is 0
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.withClosedMode
mapView : String -> Html Msg
mapView apiKey =
Map.init apiKey
|> Map.withPolygons [ myPolygon ]
|> Map.toHtml