출처: https://github.com/Leaflet/Leaflet/issues/2286
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
One way is to do MapClick.on('click', L.bind(onMapClick, null, ID)).
출처 - 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 |
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 전체 영역에 지도가 표시되지 않을 때는
mymap.invalidateSize();
invalidateSize() 를 호출한다.
head 섹션에 Leaflet CSS를 포함합니다.
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
Leaflet 자바스크립트 파일을 포함합니다.
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
지도가 보일 위치에 div 엘레먼트를 넣습니다.
<div id="mapid"></div>
CSS 설정을 통해서 지도 컨테이너의 높이를 정의합니다.
#mapid { height: 180px; }