florianfmmartin / LeafletPluto.jl

A simple map widget for Pluto.jl notebooks. It creates a map using [Leaflet](https://leafletjs.com/).
MIT License
0 stars 0 forks source link

LeafletPluto.jl

Build Status

A simple map widget for Pluto.jl notebooks. It creates a map using Leaflet.

screenshot of a pluto notebook showing a cell with a map that has a few lines, a polygon, a circle and a marker.

Prerequisites

LeafletPluto is a package for Julia. It is is designed to be used in Pluto notebooks. If you are using Pluto, you're ready to use this package!

Usage

Basic usage looks like this:

using LeafletPluto

# create a map
m = Map(center = (0, 0), option = staticMapOption())

# add a few elements to it
build(m, Polyline(latlngs = [(0, 5), (0, 10), (0, 15)]))
build(m, Polyline(latlngs = [(5, 0), (10, 0), (15, 0)], path = Path(color = "#88ff33")))
build(m, Polygon(latlngs = [(2, 6), (6, 6), (6, 10), (2, 10)]))
build(m, Circle(center = (-4, -4), radius = 500_000, path = Path(color = "red")))
build(m, Marker((-4, -4)))

# display it
leaflet(m)

Tile layer

This is inspired from PlutoMapPicker.jl

Maps use a raster tile layer to show the actual map. This layer is built of images of the world map. To load in these tiles as needed, the map must request the tiles from an API.

The default setting will request tiles from Open Street Map, but you can change this setting. The package also includes some ready-to-go configurations for Stadia Maps. For example:

Map(center=(0, 0), tile=stadia_tile_layers.outdoors)

You can also create a custom TileLayer to use a different server or make requests with an API key.

Please note that PlutoMapPicker & LeafletPluto are not affiliated with Open Street Map or Stadia Maps. The TileLayer configurations for these services are provided for convenience, but it is up to you whether the way you're using these services complies with their usage policy. See Open Street Map's usage policy and Stadia Map's documentation for more information.

Licence

This package is shared under an MIT licence. See LICENSE for more information.