문서 보기역링크PDF로 내보내기맨 위로 이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요. ## [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<br>KML<br>Shapefile<br>WKT<br>WKB<br>geobuf|GeoRSS<br>Encoded Polylines(Google)| |javascript apis|OpenLayers<br>d3<br>ArcGIS API for Javascript<br>Mapbox GL JS|Leaflet<br>Google Maps API<br>Tangram| ![](https://goo.gl/YdWxQD) ### Leaflet setview : 화면 위치 변경 |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 ``` ### 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 <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" /> ``` Leaflet 자바스크립트 파일을 포함합니다. ```javascript <script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script> ``` 지도가 보일 위치에 div 엘레먼트를 넣습니다. ```javascript <div id="mapid"></div> ``` CSS 설정을 통해서 지도 컨테이너의 높이를 정의합니다. ```javascript #mapid { height: 180px; } ``` open/leaflet-파라미터전달.txt 마지막으로 수정됨: 2020/06/02 09:25저자 127.0.0.1