jackhp95/elm-mapbox/1.0.0

NOTE: the latest version is 2.0.0

Rerouted (archive, verified). The original repository is gone. This copy comes from an archive (Software Heritage). The Lamdera package server serves a copy recovered from swh:1:rev:8c337257b1c76e6dc7f0ef69b342342fb28509f1 (Software Heritage, origin https://github.com/jackhp95/elm-mapbox).

What we checked: Software Heritage archived tag 1.0.0 of github.com/jackhp95/elm-mapbox at commit 8c337257b1c7; its commit 8c337257b1c7 is from 2019-04-19 05:30 UTC, before the version was published (2019-04-19 05:35 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, made from Software Heritage's copy of the files Elm uses, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/jackhp95/elm-mapbox/zipball/1.0.0/

Maps.Map

Functions for manipulating the Map.

type alias Map =
Map

The map type contains all the information necessary to display a map on the screen. The map type is opaque, so use the functions in this module to maniuplate the map.

Setters

The setters can be used to modify a map

For example, MapBox tiles on a large map:

map
|> setTileServer ("https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=" ++ accessToken)
|> setWidth 1200
|> setHeight 800
setTileServer : String -> Map -> Map

Set the tile server.

The format is a URL with {x} {y} {z} placeholders for the x, y and zoom coordinates.

setWidth : Float -> Map -> Map

Set the width, as displayed on the screen, of a given Map.

setHeight : Float -> Map -> Map

Set the height, as displayed on the screen, of a given Map.

setTileSize : Float -> Map -> Map

Set the width/height in px of a tile. Note, this is dependent on the tile server, and the default of 256px is almost always correct.

Map Movement and Zooming

move : Offset -> Map -> Map

Move the map a given number of pixels in the x and y dimensions.

For example, up 10px and right 10px:

map
|> move { x = 10, y = -10 }
moveTo : LatLng -> Map -> Map

Move the center of the map to a specific location.

For example, move the map to Shanghai:

map
|> moveTo (Maps.Geo.LatLng 31.267401 121.522179)
setZoom : Float -> Map -> Map

Sets the zoom to a specific level

For example, zoom all the way out

map
|> zoom 0

Or all the way in:

map
|> zoom 19
zoom : Float -> Map -> Map

Zoom into the center of the map.

For example zoom out two levels:

map
|> zoom -2
zoomTo : Float -> Offset -> Map -> Map

Zoom into an x,y co-ordinate on the map.

For example, zoom into the top left corner of the map:

map
|> zoom 1 { x = 0, y = 0}
viewBounds : Bounds -> Map -> Map

Move and zoom the map to cover given the bounds.

For example, view the bounds of Madagascar:

let
  madagascar =
    Maps.Geo.bounds
      { northEast = Maps.Geo.latLng -11.9519639 50.48377989999999
      , southWest = Maps.Geo.latLng -25.6065157 43.1851395
      }
in
  map
  |> viewBounds madagascar