The optional attributes customize the look and behavior of the map and its elements (described below).
features("na[tourism=hotel]").map.save("hotels") # (.html file extension by default) my_map = Map() my_map.add(features("na[amenity=fire_station]"), color="red") my_map.add(features("n[emergency=fire_hydrant]"), color="orange") my_map.show()
These attributes apply to the map itself. They can be passed as keyword arguments or accessed as properties of the
|Tile server URL for the base map (Default: OpenStreetMap Carto)|
|Attribution text to display at the bottom of the map (This is required if you publicly display your map, and defaults to “© OpenStreetMap”)|
|Version of the Leaflet to use|
|URL from which Leaflet is loaded (By default, Leaflet is loaded from UNPKG)|
|URL for a custom CSS file (to customize the appearance of the Leaflet map controls)|
|Minimum zoom level. Default: 0|
|Maximum zoom level: Default: 19|
These attributes apply to individual map elements. They can be passed as keyword arguments or accessed as properties of the
Map object (in which case they act as default attributes).
|Text (HTML) to display when the user places the mouse cursor over an element. Default: |
|URL to navigate when the user clicks on an element. Default: |
|Whether to draw the element’s stoke. Default: |
|The stroke color. Default: |
|Stroke width in pixels. Default: 3|
|Stroke opacity. Default: 1.0|
|A string that defines shape to be used at the end of the stroke. Default: |
|A string that defines shape to be used at the corners of the stroke. Default: |
|A string that defines the stroke dash pattern. Default: |
|A string that defines the distance into the dash pattern to start the dash. Default: |
|Whether to fill the element with color. Default: |
|Fill color. Defaults to the value of |
|Fill opacity. Default: 0.2|
To open the feature’s website (if it has one):
To display the feature on the official OpenStreetMap website (where you can see more information, such as its revision history):
To edit the feature in iD (the default OpenStreetMap editor):
All are mutable.
Creates a map marker for the given item:
- a geometric object (
- any object that has an
- an iterable that contains any of the above (e.g. a feature set)
Saves the map as an HTML file (If the file name has no extension,
.html is used).
Opens a browser window to display the map. If the map hasn’t been explicitly saved to an HTML file, this method creates a temporary file.