generated from giswqs/jupyter-book-demo
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
207 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,15 +491,198 @@ <h1>Get Started</h1> | |
<h1><span class="section-number">8. </span>Get Started<a class="headerlink" href="#get-started" title="Link to this heading">#</a></h1> | ||
<div class="cell docutils container"> | ||
<div class="cell_input docutils container"> | ||
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">print</span><span class="p">(</span><span class="s2">"Hello World!"</span><span class="p">)</span> | ||
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">leafmap</span> | ||
</pre></div> | ||
</div> | ||
</div> | ||
<div class="cell_output docutils container"> | ||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Hello World! | ||
</div> | ||
<div class="cell docutils container"> | ||
<div class="cell_input docutils container"> | ||
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">m</span> <span class="o">=</span> <span class="n">leafmap</span><span class="o">.</span><span class="n">Map</span><span class="p">()</span> | ||
<span class="n">m</span> | ||
</pre></div> | ||
</div> | ||
</div> | ||
<div class="cell_output docutils container"> | ||
<div class="output text_html"><iframe srcdoc="<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
<script> | ||
L_NO_TOUCH = false; | ||
L_DISABLE_3D = false; | ||
</script> | ||
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style> | ||
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script> | ||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"/> | ||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"/> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/> | ||
<meta name="viewport" content="width=device-width, | ||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | ||
<style> | ||
#map_1638534ca2d35186c80b395aeed7e7c2 { | ||
position: relative; | ||
width: 100.0%; | ||
height: 100.0%; | ||
left: 0.0%; | ||
top: 0.0%; | ||
} | ||
.leaflet-container { font-size: 1rem; } | ||
</style> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/Control.FullScreen.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/Control.FullScreen.css"/> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.js"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.css"/> | ||
<script src="https://cdn.jsdelivr.net/gh/ljagis/[email protected]/dist/leaflet-measure.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/ljagis/[email protected]/dist/leaflet-measure.min.css"/> | ||
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css"/> | ||
</head> | ||
<body> | ||
<div class="folium-map" id="map_1638534ca2d35186c80b395aeed7e7c2" ></div> | ||
</body> | ||
<script> | ||
var map_1638534ca2d35186c80b395aeed7e7c2 = L.map( | ||
"map_1638534ca2d35186c80b395aeed7e7c2", | ||
{ | ||
center: [20.0, 0.0], | ||
crs: L.CRS.EPSG3857, | ||
zoom: 2, | ||
zoomControl: true, | ||
preferCanvas: false, | ||
drawExport: false, | ||
layersControl: true, | ||
} | ||
); | ||
L.control.scale().addTo(map_1638534ca2d35186c80b395aeed7e7c2); | ||
var tile_layer_9696ba6a893c3cf519eb003386158e42 = L.tileLayer( | ||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png", | ||
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 24, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false} | ||
); | ||
tile_layer_9696ba6a893c3cf519eb003386158e42.addTo(map_1638534ca2d35186c80b395aeed7e7c2); | ||
L.control.fullscreen( | ||
{"forceSeparateButton": false, "position": "topleft", "title": "Full Screen", "titleCancel": "Exit Full Screen"} | ||
).addTo(map_1638534ca2d35186c80b395aeed7e7c2); | ||
var options = { | ||
position: "topleft", | ||
draw: {}, | ||
edit: {}, | ||
} | ||
// FeatureGroup is to store editable layers. | ||
var drawnItems_draw_control_671b62627f711e68d81a575006c9154d = new L.featureGroup().addTo( | ||
map_1638534ca2d35186c80b395aeed7e7c2 | ||
); | ||
options.edit.featureGroup = drawnItems_draw_control_671b62627f711e68d81a575006c9154d; | ||
var draw_control_671b62627f711e68d81a575006c9154d = new L.Control.Draw( | ||
options | ||
).addTo( map_1638534ca2d35186c80b395aeed7e7c2 ); | ||
map_1638534ca2d35186c80b395aeed7e7c2.on(L.Draw.Event.CREATED, function(e) { | ||
var layer = e.layer, | ||
type = e.layerType; | ||
var coords = JSON.stringify(layer.toGeoJSON()); | ||
layer.on('click', function() { | ||
alert(coords); | ||
console.log(coords); | ||
}); | ||
drawnItems_draw_control_671b62627f711e68d81a575006c9154d.addLayer(layer); | ||
}); | ||
map_1638534ca2d35186c80b395aeed7e7c2.on('draw:created', function(e) { | ||
drawnItems_draw_control_671b62627f711e68d81a575006c9154d.addLayer(e.layer); | ||
}); | ||
var measure_control_e70230025a28224cdb4d9b848febb5e5 = new L.Control.Measure( | ||
{"position": "bottomleft", "primaryAreaUnit": "sqmeters", "primaryLengthUnit": "meters", "secondaryAreaUnit": "acres", "secondaryLengthUnit": "miles"}); | ||
map_1638534ca2d35186c80b395aeed7e7c2.addControl(measure_control_e70230025a28224cdb4d9b848febb5e5); | ||
// Workaround for using this plugin with Leaflet>=1.8.0 | ||
// https://github.com/ljagis/leaflet-measure/issues/171 | ||
L.Control.Measure.include({ | ||
_setCaptureMarkerIcon: function () { | ||
// disable autopan | ||
this._captureMarker.options.autoPanOnFocus = false; | ||
// default function | ||
this._captureMarker.setIcon( | ||
L.divIcon({ | ||
iconSize: this._map.getSize().multiplyBy(2) | ||
}) | ||
); | ||
}, | ||
}); | ||
var geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e = {"collapsed": true, "defaultMarkGeocode": true, "position": "topleft", "provider": "nominatim", "providerOptions": {}, "zoom": 11}; | ||
// note: geocoder name should start with lowercase | ||
var geocoderName_geocoder_55a15d15476f034c17defb5dcd060c6e = geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e["provider"]; | ||
var customGeocoder_geocoder_55a15d15476f034c17defb5dcd060c6e = L.Control.Geocoder[ geocoderName_geocoder_55a15d15476f034c17defb5dcd060c6e ]( | ||
geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e['providerOptions'] | ||
); | ||
geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e["geocoder"] = customGeocoder_geocoder_55a15d15476f034c17defb5dcd060c6e; | ||
L.Control.geocoder( | ||
geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e | ||
).on('markgeocode', function(e) { | ||
var zoom = geocoderOpts_geocoder_55a15d15476f034c17defb5dcd060c6e['zoom'] || map_1638534ca2d35186c80b395aeed7e7c2.getZoom(); | ||
map_1638534ca2d35186c80b395aeed7e7c2.setView(e.geocode.center, zoom); | ||
}).addTo(map_1638534ca2d35186c80b395aeed7e7c2); | ||
map_1638534ca2d35186c80b395aeed7e7c2.fitBounds( | ||
[[20, 0], [20, 0]], | ||
{"maxZoom": 2} | ||
); | ||
var layer_control_371687819fe8fa30659cea23b5d25e22_layers = { | ||
base_layers : { | ||
"openstreetmap" : tile_layer_9696ba6a893c3cf519eb003386158e42, | ||
}, | ||
overlays : { | ||
}, | ||
}; | ||
let layer_control_371687819fe8fa30659cea23b5d25e22 = L.control.layers( | ||
layer_control_371687819fe8fa30659cea23b5d25e22_layers.base_layers, | ||
layer_control_371687819fe8fa30659cea23b5d25e22_layers.overlays, | ||
{"autoZIndex": true, "collapsed": true, "position": "topright"} | ||
).addTo(map_1638534ca2d35186c80b395aeed7e7c2); | ||
</script> | ||
</html>" width="100%" height="600"style="border:none !important;" "allowfullscreen" "webkitallowfullscreen" "mozallowfullscreen"></iframe></div></div> | ||
</div> | ||
</section> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.