|
|
|
|
|
현재, 작업중인 프로그램에 ConvertXYLatLon 메소드를 이용하여 Point 로 위도/경도 값을 구해와서 Marker 를 추가하는 기능을 넣고 있습니다. Map 영역은 Width, Height 각각 100 % 의 값을 주었습니다. (아래참고)
<html> <header> ...
<style type="text/css"> #map { width: 100%; height: 100%; } </style>
... </header> <body> <div id="map"></div> </body> </html>
이때, Resize 되어 Map 영역이 달라질 경우 ConvertXYLatLon 메소드를 이용하여 받아오는 위도/경도 값이 올바르지 않습니다. Document 를 Reload 하지 않고 이 문제를 해결할 방법이 있나요?
----------------------------------------------------------------------------------
resizeTo() 를 이용해도 동일한 문제가 발생하는 것 같습니다. 아래코드는 resizeTo() 를 이용해서 Map Area 를 변경한 후 Marker 를 추가할 때 정상적인 위치에 추가가되는지 확인을 위한 코드입니다.
<html> <head> <script type="text/javascript " src="http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.7&appid=YahooDemo"></script> <style type="text/css"> #map{ height: 300px; width: 400px; } </style> </head> <body> <button onC lick="javascript :resize();">Size change</button> <div id="map"></div> <script type="text/javascript "> var map = new YMap(document.getElementById('map')); function startMap(){ map.addTypeControl(); map.addZoomLong(); map.addPanControl(); map.drawZoomAndCenter("San Francisco", 3); YEvent.Capture(map, EventsList.MouseClick, reportPosition); function reportPosition(_e, _c){ var mapCoordCenter = map.convertLatLonXY(map.getCenterLatLon()); YLog.initPos(mapCoordCenter); //call initPos to set the starting location YLog.print("You Made a MouseClick!"); YLog.print("Latitude:" + _c.Lat); YLog.print("Longitude:" + _c.Lon); YLog.print("Adding marker at...."); YLog.print("\nLatitude:" + _c.Lat + "\nLongitude:" + _c.Lon); var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); } } function resize() { map.resizeTo(new YSize(700, 400)); } window.onload = startMap; </script> </body> </html>
|
http://kr.blog.yahoo.com/gugi_openapi/trackback/12/67
-
거기오픈API 2008.09.09 10:07
-
지도 크기 변경시
resizeTo(YSize) 메쏘드를 사용하여 지도 사이즈를 재설정 하거나
지도의 크기를 %가 아닌 pixel로 해보시는것은 어떨까 합니다.
감사합니다.
답글쓰기
-
-
finher78@Y 2008.09.09 20:13
-
resizeTo() 를 이용해도 ConvertXYLatLon() 에서 얻어지는 값이 올바르지 않네요. endMapDraw 이벤트 발생 시 Map Area 의 사이즈를 저장해 두었다가 Map Area 의 특정 영역의 Lat/Lon 값을 구할 경우 저장된 Map Area 사이즈와 실제 사이즈의 차를 이용하여 적용했습니다.
답글쓰기
-
-
finher78@Y 2008.09.09 20:19
-
http://kr.open.gugi.yahoo.com/document/sample/sample_07.html
에서 Browser 사이즈 변경 후 Marker 추가 시 엉뚱한 곳에 찍히는 것을 확인 할 수 있습니다.
답글쓰기
-
-
finher78@Y 2008.09.10 14:24
-
Yahoo API 3.5 까지는 정상적으로 동작하네요. 버그가 아닌가 싶습니다.
답글쓰기
-
-
거기오픈API 2008.09.10 14:36
-
관련하여 좀더 자세히 확인후 버그로 판명되면 조취 하도록 하겠습니다.
감사합니다.
답글쓰기
-
|
|
|
|
|