Python Leaflet openstreetmap log 2


https://ithelp.ithome.com.tw/articles/10203091

https://ithelp.ithome.com.tw/articles/10203732


GIS中常用網格圖層表示地形的高低起伏

拖曳且自動平移,並設定距邊界200pixel時,自動平移地圖,一次平移量為25 pixel。


{% extends "base.html" %}

{% block content %}
<h1>Welcome to our site</h1>

<div id="mapid" style="width: 80%;"></div>

<script type="application/javascript">
(function($){
$(document).ready(function(){
$('#mapid').height(window.innerHeight);
var myMap = L.map('mapid', {
center: [22.73444963475145, 120.28458595275877],
zoom: 14
});

L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 14,
attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}).addTo(myMap);

var NUK = L.marker([22.73444963475145, 120.28458595275877]);
myMap.addLayer(NUK);

L.marker([22.73444963475145, 120.28458595275877], {
draggable:true,
autoPan: true,
autoPanPadding: [200, 200],
autoPanSpeed: 25
}).addTo(myMap);


nukPopup = L.popup().setLatLng([22.7249, 120.2540]).setContent("蚵仔寮潮位站")
myMap.openPopup(nukPopup);



});
})($);


</script>


<p>This is demo applicaiton for the course
<em>Getting started</em>
<a href="www.google.com">Google</a>
</p>
<h2>Meeting</h2>
<img src="/static/website/calendar.png" width="100px" >

<ul> {% for meeting in meetings %}
<li>
<a href="{% url 'detail' meeting.id %}">
{{ meeting.title }}
</a>
</li>
{% endfor %}
</ul>
<a href="{% url 'rooms' %}">Rooms list</a>
{% endblock %}


var OpenTopoMap = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { maxZoom: 17, attribution: 'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)' });

* 不能同一個HTML 用兩個地圖, 要研究



呢個要研
imageBounds = [[19.500625745, 115.976888855],
[28.09937425, 126.02300114]];
同埋個open source 都要諗諗.

https://opendata.cwb.gov.tw/dataset/observation?page=7

哈哈哈



{% extends "base.html" %}

{% block content %}
<h1>Welcome to our site</h1>

<div id="mapid" style="width: 80%;"></div>
<div >Image</div>
<div id="mapid2" style="width: 80%;"></div>

<script type="application/javascript">
(function($){
$(document).ready(function(){
$('#mapid').height(window.innerHeight);
var myMap = L.map('mapid', {
center: [22.73444963475145, 120.28458595275877],
zoom: 6
});

// imageBounds = [[18.600625745, 115.976888855],[27.79937425, 126.02300114]];

var imageUrl = 'https://opendata.cwb.gov.tw/fileapi/opendata/MSC/O-B0030-003.jpg',
imageBounds = [[19.500625745, 115.976888855],
[28.09937425, 126.02300114]];
imageUrlLayer = L.imageOverlay(imageUrl, imageBounds, {
opacity:0.4
}).addTo(myMap);

L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 14,
attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}).addTo(myMap);

var NUK = L.marker([22.73444963475145, 120.28458595275877]);
myMap.addLayer(NUK);

L.marker([22.73444963475145, 120.28458595275877], {
draggable:true,
autoPan: true,
autoPanPadding: [200, 200],
autoPanSpeed: 25
}).addTo(myMap);

nukPopup = L.popup().setLatLng([22.7249, 120.2540]).setContent("蚵仔寮潮位站")
myMap.openPopup(myMap);








});
})($);


</script>


<p>This is demo applicaiton for the course
<em>Getting started</em>
<a href="www.google.com">Google</a>
</p>
<h2>Meeting</h2>
<img src="/static/website/calendar.png" width="100px" >

<ul> {% for meeting in meetings %}
<li>
<a href="{% url 'detail' meeting.id %}">
{{ meeting.title }}
</a>
</li>
{% endfor %}
</ul>
<a href="{% url 'rooms' %}">Rooms list</a>
{% endblock %}

Change image



{% extends "base.html" %}

{% block content %}
<h1>Welcome to our site</h1>

<div id="mapid" style="width: 80%;"></div>
<div >Image</div>
<div id="mapid2" style="width: 80%;"></div>

<script type="application/javascript">
(function($){
$(document).ready(function(){
$('#mapid').height(window.innerHeight);
var myMap = L.map('mapid', {
center: [22.73444963475145, 120.28458595275877],
zoom: 6
});

// imageBounds = [[18.600625745, 115.976888855],[27.79937425, 126.02300114]];

//https://opendata.cwb.gov.tw/fileapi/opendata/MSC/O-B0030-003.jpg
var imageUrl = '/static/website/abc.jpeg',
imageBounds = [[19.500625745, 115.976888855],
[28.09937425, 126.02300114]];
imageUrlLayer = L.imageOverlay(imageUrl, imageBounds, {
opacity:0.4
}).addTo(myMap);

L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 14,
attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
}).addTo(myMap);

var NUK = L.marker([22.73444963475145, 120.28458595275877]);
myMap.addLayer(NUK);

L.marker([22.73444963475145, 120.28458595275877], {
draggable:true,
autoPan: true,
autoPanPadding: [200, 200],
autoPanSpeed: 25
}).addTo(myMap);

nukPopup = L.popup().setLatLng([22.7249, 120.2540]).setContent("蚵仔寮潮位站")
myMap.openPopup(myMap);








});
})($);


</script>


<p>This is demo applicaiton for the course
<em>Getting started</em>
<a href="www.google.com">Google</a>
</p>
<h2>Meeting</h2>
<img src="/static/website/calendar.png" width="100px" >

<ul> {% for meeting in meetings %}
<li>
<a href="{% url 'detail' meeting.id %}">
{{ meeting.title }}
</a>
</li>
{% endfor %}
</ul>
<a href="{% url 'rooms' %}">Rooms list</a>
{% endblock %}
=====================
20200713

之前出現這個問係tooltops 問題, delete 左就無事

jquery-3.2.1.min.js:2 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
at e._updateContent (leaflet.js:5)
at e.update (leaflet.js:5)
at e.onAdd (leaflet.js:5)
at e.onAdd (leaflet.js:5)
at e._layerAdd (leaflet.js:5)
at e.whenReady (leaflet.js:5)
at e.addLayer (leaflet.js:5)
at e.openPopup (leaflet.js:5)
at HTMLDocument. ((index):60)
at j (jquery-3.2.1.min.js:2)

留言

這個網誌中的熱門文章

香港袐密行動

要老是忘記, 我更記不起