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.toHtmlUpholds the possible types of surface for viewing the map.
API key provided by Google for accessing their maps' services.
This type is latitude in float format as expected by Google Maps.
This type is longitude in float format as expected by Google Maps.
You 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
Embeds buttons for controlling the map viewing.
Embeds buttons for the user to change the map type in runtime.
Provides a button for entering the Street View mode.
Provides a scrolling bar for controlling the current zooming in the map.
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.toHtmlMap with terrain specifications, mountains, rivers, and other geospatial information.
Handles the fleet-engine's journey-sharing feature.
Handles the fleet-engine's location provider.
Sets the journey-sharing feature.
Specifies the journey-sharing feature.
Specifies a location provider for the fleet-engine.
Sets 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.toHtmlTriggers with every click on the map.
Triggers once the map is loaded.
Provides a controllable feature of allowing the user to draw polygons on the map.
Opaque type that upholds the map description.