Create a Map with Folium and Leaflet.js Generate a base map of given width and height with either default tilesets or a custom tileset URL. Folium has built-in all tilesets available in the ``xyzservices`` package. For example, you can pass any of the following to the "tiles" keywor
| 80 | |
| 81 | |
| 82 | class Map(JSCSSMixin, Evented): |
| 83 | """Create a Map with Folium and Leaflet.js |
| 84 | |
| 85 | Generate a base map of given width and height with either default |
| 86 | tilesets or a custom tileset URL. Folium has built-in all tilesets |
| 87 | available in the ``xyzservices`` package. For example, you can pass |
| 88 | any of the following to the "tiles" keyword: |
| 89 | |
| 90 | - "OpenStreetMap" |
| 91 | - "CartoDB Positron" |
| 92 | - "CartoDB Voyager" |
| 93 | |
| 94 | Explore more provider names available in ``xyzservices`` here: |
| 95 | https://leaflet-extras.github.io/leaflet-providers/preview/. |
| 96 | |
| 97 | You can also pass a custom tileset by passing a |
| 98 | :class:`xyzservices.TileProvider` or a Leaflet-style |
| 99 | URL to the tiles parameter: ``https://{s}.yourtiles.com/{z}/{x}/{y}.png``. |
| 100 | |
| 101 | Parameters |
| 102 | ---------- |
| 103 | location: tuple or list, default None |
| 104 | Latitude and Longitude of Map (Northing, Easting). |
| 105 | width: pixel int or percentage string (default: '100%') |
| 106 | Width of the map. |
| 107 | height: pixel int or percentage string (default: '100%') |
| 108 | Height of the map. |
| 109 | tiles: str or TileLayer or :class:`xyzservices.TileProvider`, default 'OpenStreetMap' |
| 110 | Map tileset to use. Can choose from a list of built-in tiles, |
| 111 | pass a :class:`xyzservices.TileProvider`, |
| 112 | pass a custom URL, pass a TileLayer object, |
| 113 | or pass `None` to create a map without tiles. |
| 114 | For more advanced tile layer options, use the `TileLayer` class. |
| 115 | min_zoom: int, optional, default 0 |
| 116 | Minimum allowed zoom level for the tile layer that is created. |
| 117 | Filled by xyzservices by default. |
| 118 | max_zoom: int, optional, default 18 |
| 119 | Maximum allowed zoom level for the tile layer that is created. |
| 120 | Filled by xyzservices by default. |
| 121 | zoom_start: int, default 10 |
| 122 | Initial zoom level for the map. |
| 123 | attr: string, default None |
| 124 | Map tile attribution; only required if passing custom tile URL. |
| 125 | crs : str, default 'EPSG3857' |
| 126 | Defines coordinate reference systems for projecting geographical points |
| 127 | into pixel (screen) coordinates and back. |
| 128 | You can use Leaflet's values : |
| 129 | * EPSG3857 : The most common CRS for online maps, used by almost all |
| 130 | free and commercial tile providers. Uses Spherical Mercator projection. |
| 131 | Set in by default in Map's crs option. |
| 132 | * EPSG4326 : A common CRS among GIS enthusiasts. |
| 133 | Uses simple Equirectangular projection. |
| 134 | * EPSG3395 : Rarely used by some commercial tile providers. |
| 135 | Uses Elliptical Mercator projection. |
| 136 | * Simple : A simple CRS that maps longitude and latitude into |
| 137 | x and y directly. May be used for maps of flat surfaces |
| 138 | (e.g. game maps). Note that the y axis should still be inverted |
| 139 | (going from bottom to top). |