加载完地图后,加载点、线、面应该是最基本的功能之一了。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="leaflet1.34/leaflet-src.js"></script>
<link rel="stylesheet" href="leaflet1.34/leaflet.css">
<style>
html,body{
width: 100%;
height: 100%;
}
#mapDiv{
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="mapDiv"></div>
<script>
var map = L.map("mapDiv").setView([36.55,117.32],13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
L.marker([36.55,117.32]).addTo(map);
L.polyline([[36.54,117.33],[36.55,117.33],[36.56,117.35],[36.55,117.36]]).a