open:leaflet-파라미터전달

출처: https://github.com/Leaflet/Leaflet/issues/2286

snippet.javascript
function fnOnClick(data) {				
	debugger;				
}
 
L.marker([ data.st_y, data.st_x ]).on('click', L.bind(fnOnClick, null, data));

L.marker([ data.sty, data.stx ]).on('click', fnOnClick);

대신에

L.bind(fnOnClick, null, data) 를 사용하여 파라미터를 전달한다.

https://github.com/Leaflet/Leaflet/issues/2286

snippet.javascript
One way is to do MapClick.on('click', L.bind(onMapClick, null, ID)).

출처 - http://www.macwright.org/lonlat/

Geospatial 소프트웨어들에서 경도, 위도를 입력하는 방식이 일치하지 않는다.

type lon, lat (경도, 위도) lat, lon (위도, 경도)
formatsGeoJSON<br>KML<br>Shapefile<br>WKT<br>WKB<br>geobufGeoRSS<br>Encoded Polylines(Google)
javascript apisOpenLayers<br>d3<br>ArcGIS API for Javascript<br>Mapbox GL JSLeaflet<br>Google Maps API<br>Tangram

YdWxQD

Method Returns Description
setView( <LatLng> center, <Number> zoom?, <zoom/pan options> options? ) this Sets the view of the map (geographical center and zoom) with the given animation options.
위도: latitude, X
경도: longitude, Y

lLKz2k

이와 같이 Leaflet 전체 영역에 지도가 표시되지 않을 때는

snippet.javascript
mymap.invalidateSize();

invalidateSize() 를 호출한다.

lXWBDp

http://leafletjs.com/

Leaflet Quick Start Guide

head 섹션에 Leaflet CSS를 포함합니다.

snippet.javascript
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />

Leaflet 자바스크립트 파일을 포함합니다.

snippet.javascript
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>

지도가 보일 위치에 div 엘레먼트를 넣습니다.

snippet.javascript
<div id="mapid"></div>

CSS 설정을 통해서 지도 컨테이너의 높이를 정의합니다.

snippet.javascript
#mapid { height: 180px; }

  • open/leaflet-파라미터전달.txt
  • 마지막으로 수정됨: 2020/06/02 09:25
  • 저자 127.0.0.1