leaflet 플러그인

3254 단어

	
	Leaflet class diagram - Leaflet

	
	
	
	

    
    


	

	


var w = 1200, h = 224, url = 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390091895,3621563906&fm=200&gp=0.jpg'; var map = L.map('map', { // crs: L.CRS.Simple, maxZoom: 0, minZoom: -4, center: [0, 0], zoom: 1 }); var southWest = map.unproject([0, h], map.getMaxZoom() - 1); var northEast = map.unproject([w, 0], map.getMaxZoom() - 1); var bounds = new L.LatLngBounds(southWest, northEast); L.imageOverlay(url, bounds).addTo(map); map.setMaxBounds(bounds); : : var shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png"; var orangeUrl = "http://leafletjs.com/examples/custom-icons/leaf-orange.png"; var redUrl = "http://leafletjs.com/examples/custom-icons/leaf-red.png"; var greenUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png"; var w = 1200, h = 224, url = 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390091895,3621563906&fm=200&gp=0.jpg'; var map = L.map('map', { // crs: L.CRS.Simple, maxZoom: 0, minZoom: -4, center: [0, 0], zoom: 1 }); var southWest = map.unproject([0, h], map.getMaxZoom() - 1); var northEast = map.unproject([w, 0], map.getMaxZoom() - 1); var bounds = new L.LatLngBounds(southWest, northEast); var LeafIcon = L.Icon.extend({ options: { shadowUrl: shadowUrl, iconSize: [38, 95], shadowSize: [50, 64], iconAnchor: [22, 94], shadowAnchor: [4, 62], popupAnchor: [-3, -76] } }); var greenIcon = new LeafIcon({ iconUrl: greenUrl }); var redIcon = new LeafIcon({ iconUrl: redUrl }); var orangeIcon = new LeafIcon({ iconUrl: orangeUrl }); L.marker([0, 0], { icon: greenIcon }).bindPopup("I am a green leaf.").addTo(map); L.marker([0, 100], { icon: redIcon }).bindPopup("I am a red leaf.").addTo(map); L.marker([0, 200], { icon: orangeIcon }).bindPopup("I am an orange leaf.").addTo(map); var image = L.imageOverlay(url, bounds,{interactive:true}).addTo(map); // var marker = L.marker([0, 0]).addTo(map); map.setMaxBounds(bounds);

좋은 웹페이지 즐겨찾기