var wgs84Sphere= new ol.Sphere(6378137); //http://openlayers.org/en/latest/apidoc/ol.Sphere.html 참고
var distance = wgs84Sphere.haversineDistance(ol.proj.transform(coor1, "EPSG:900913",'EPSG:4326'),ol.proj.transform(coor2, "EPSG:900913",'EPSG:4326'))
반경 원 그리기
https://stackoverflow.com/questions/23264721/how-to-draw-circle-with-radius-in-openlayers
검색하다가 찾음....
반지름 계산
맵 객체 , 반지름 지정값 (m), 좌표값
var drawMeter = function(map, radius, cood) {
var view = map.getView(); // 맴객체의 뷰
var projection = view.getProjection(); // 프로젝션 정보를 가지고옴 EPGS:3857
var resolutionAtEquator = view.getResolution(); //해상도
//var pointResolution = projection.getPointResolution(resolutionAtEquator, cood); //점포인트의 해상도 Openlayers 3버전??
var pointResolution = ol.proj.getPointResolution(projection,resolutionAtEquator, cood); //점포인트의 해상도 Openlayers 4버전??
var resolutionFactor = resolutionAtEquator/pointResolution; //
var radius = (radius / ol.proj.METERS_PER_UNIT.m) * resolutionFactor;
return radius;
}
'개발자공부 > Openlayers' 카테고리의 다른 글
[openlayers]오픈레이어스 circle , style circle 차이 (0) | 2018.06.11 |
---|---|
[openlayers] 오픈레이어스 여집합,반전 폴리곤 구현하기 (0) | 2018.06.05 |
오픈레이어스 클릭 이벤트, 오버레이, 인터렉션 스타일변경 (0) | 2017.06.28 |
브이월드 검색 , NS센터 API 법정동 샘플 (0) | 2017.06.27 |
브이월드 검색 API , 오픈레이어스 클러스터기능 활용하기 (0) | 2017.06.27 |