OpenLayers 오픈레이어에서 마우스 클릭 위치 좌표값 가져오는 여러가지 방법 > 개발

본문 바로가기
사이트 내 전체검색

개발

OpenLayers 오픈레이어에서 마우스 클릭 위치 좌표값 가져오는 여러가지 방법

페이지 정보

profile_image
작성자 관리자 (61.♡.26.29)
댓글 0건 조회 6,181회 작성일 17-04-22 22:57

본문

오픈레이어로 지도 작업할 때, 지도위에 마우스를 클릭한 위치의 좌표값을 알아내는 방법들이다.

[code]
feature.geometry.getBounds().getCenterLonLat()
[/code]
or

[code]
map.events.register("click", map, function(e) {
    var latlon = map.getLonLatFromViewPortPx(e.xy) ;
    alert(lonlat);
});
[/code]
or

[code]
new OpenLayers.Control.SelectFeature(layer,{
    hover:true,
    eventListeners:{
      onSelect:function(e){
        alert(e.feature.geometry)
    }
});
[/code]
or

[code]
layer.events.on({
            "featureselected": function(e) {     
            alert(e);
            }
});   
[/code]



** 출처 : https://gis.stackexchange.com/questions/22240/openlayers-selectfeature-get-mouse-position

추천0

댓글목록

등록된 댓글이 없습니다.

Total 392건 15 페이지
  • RSS
개발 목록
번호 제목 조회 추천 날짜
1122550002-17
1112609002-17
1102606002-25
1092163002-26
1082009002-26
1072193002-27
1061960002-27
1052637003-01
1042711003-06
1033513003-06
1023791003-24
1013661003-25
1003376004-07
992517004-07
983758004-11
972714004-12
962747004-14
952191004-14
943481004-22
932228004-25

검색


사이트 정보

Copyright © Baragi.Net. All rights reserved.