## [Leaflet] Leaflet 클릭 함수에 파라미터 전달하기 출처: https://github.com/Leaflet/Leaflet/issues/2286 ```javascript function fnOnClick(data) { debugger; } L.marker([ data.st_y, data.st_x ]).on('click', L.bind(fnOnClick, null, data)); ``` L.marker([ data.st_y, data.st_x ]).on('click', fnOnClick); 대신에 `L.bind(fnOnClick, null, data)` 를 사용하여 파라미터를 전달한다. ## Pass parameter on Click function https://github.com/Leaflet/Leaflet/issues/2286 ```javascript One way is to do MapClick.on('click', L.bind(onMapClick, null, ID)). ``` ### lon lat lon lat 출처 - http://www.macwright.org/lonlat/ Geospatial 소프트웨어들에서 경도, 위도를 입력하는 방식이 일치하지 않는다. |type | lon, lat (경도, 위도) | lat, lon (위도, 경도) | |---|---|---| |formats|GeoJSON
KML
Shapefile
WKT
WKB
geobuf|GeoRSS
Encoded Polylines(Google)| |javascript apis|OpenLayers
d3
ArcGIS API for Javascript
Mapbox GL JS|Leaflet
Google Maps API
Tangram| ![](https://goo.gl/YdWxQD) ### Leaflet setview : 화면 위치 변경 |Method |Returns |Description| |---|---|---| |setView( center, zoom?, options? ) |this |Sets the view of the map (geographical center and zoom) with the given animation options.| ``` 위도: latitude, X 경도: longitude, Y ``` ### Leaflet 전체 영역에 지도가 표시되지 않을 때 ![](https://goo.gl/lLKz2k) 이와 같이 Leaflet 전체 영역에 지도가 표시되지 않을 때는 ```javascript mymap.invalidateSize(); ``` invalidateSize() 를 호출한다. ![](https://goo.gl/lXWBDp) http://leafletjs.com/ [Leaflet Quick Start Guide](http://leafletjs.com/examples/quick-start.html) head 섹션에 Leaflet CSS를 포함합니다. ```javascript ``` Leaflet 자바스크립트 파일을 포함합니다. ```javascript ``` 지도가 보일 위치에 div 엘레먼트를 넣습니다. ```javascript
``` CSS 설정을 통해서 지도 컨테이너의 높이를 정의합니다. ```javascript #mapid { height: 180px; } ```