{"action":"created","issue":{"url":"https://api.github.com/repos/navermaps/maps.js/issues/10","repository_url":"https://api.github.com/repos/navermaps/maps.js","labels_url":"https://api.github.com/repos/navermaps/maps.js/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/navermaps/maps.js/issues/10/comments","events_url":"https://api.github.com/repos/navermaps/maps.js/issues/10/events","html_url":"https://github.com/navermaps/maps.js/issues/10","id":167804755,"number":10,"title":"How to set view port on naver map","user":{"login":"dkchittimilla","id":11506930,"avatar_url":"https://avatars.githubusercontent.com/u/11506930?v=3","gravatar_id":"","url":"https://api.github.com/users/dkchittimilla","html_url":"https://github.com/dkchittimilla","followers_url":"https://api.github.com/users/dkchittimilla/followers","following_url":"https://api.github.com/users/dkchittimilla/following{/other_user}","gists_url":"https://api.github.com/users/dkchittimilla/gists{/gist_id}","starred_url":"https://api.github.com/users/dkchittimilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkchittimilla/subscriptions","organizations_url":"https://api.github.com/users/dkchittimilla/orgs","repos_url":"https://api.github.com/users/dkchittimilla/repos","events_url":"https://api.github.com/users/dkchittimilla/events{/privacy}","received_events_url":"https://api.github.com/users/dkchittimilla/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-27T09:00:10Z","updated_at":"2016-07-27T10:08:09Z","closed_at":null,"body":"Hi,\r\n\r\nIn my code I have naver map and dynamically based on a search condition we are adding the map points. Now I want to zoom and show the map only where the points were added. Currently user need to zoom out the map to find out the map points.\r\n\r\nIn my code firstly I am creating a map with below code\r\n\r\nmapObj = new naver.maps.Map('navermap', {\r\n                        center: new naver.maps.LatLng(37.3595704, 127.105399),\r\n                        zoom: 5\r\n                    });\r\n\r\nI want to change the center based on my map points which will be generated dynamically based on search.\r\n\r\nThanks in advance.\r\n"},"comment":{"url":"https://api.github.com/repos/navermaps/maps.js/issues/comments/235543707","html_url":"https://github.com/navermaps/maps.js/issues/10#issuecomment-235543707","issue_url":"https://api.github.com/repos/navermaps/maps.js/issues/10","id":235543707,"user":{"login":"junthus","id":5088669,"avatar_url":"https://avatars.githubusercontent.com/u/5088669?v=3","gravatar_id":"","url":"https://api.github.com/users/junthus","html_url":"https://github.com/junthus","followers_url":"https://api.github.com/users/junthus/followers","following_url":"https://api.github.com/users/junthus/following{/other_user}","gists_url":"https://api.github.com/users/junthus/gists{/gist_id}","starred_url":"https://api.github.com/users/junthus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junthus/subscriptions","organizations_url":"https://api.github.com/users/junthus/orgs","repos_url":"https://api.github.com/users/junthus/repos","events_url":"https://api.github.com/users/junthus/events{/privacy}","received_events_url":"https://api.github.com/users/junthus/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T10:08:09Z","updated_at":"2016-07-27T10:08:09Z","body":"Hi @dkchittimilla\r\n\r\n\r\nTo simply place a new point at the center of the map , you can use the `setCenter` and `setZoom`\r\n```js\r\n// get coordinates by the search first,\r\n\r\nvar pointToAdd = new naver.maps.LatLng(/*y, x*/);\r\n\r\nmapObj.setCenter(pointToAdd);\r\nmapObj.setZoom(/*desired zoom level(-1~14 when default map)*/); // if you need to change zoom level\r\n```\r\n\r\nYou can also do this if you need animations. (instead of above)\r\n```js\r\nmapObj.morph(pointToAdd, desired_zoom_level); //setCenter + setZoom\r\n//or\r\nmapObj.panTo(pointToAdd) //setCenter\r\n```\r\n\r\nOr... \r\nTo show several or all of the results on one screen at once, use the `naver.map.LatLngBounds.bounds` and `fitBounds`. `naver.map.LatLngBounds.bounds` returns the boundary that contains all of the coordinates .\r\n```js\r\n// get coordinates by the search first,\r\n\r\nvar pointToAdd1 = new naver.maps.LatLng(/*y, x*/),\r\n    pointToAdd2 = new naver.maps.LatLng(/*y, x*/),\r\n    ...\r\n    pointToAddN = new naver.maps.LatLng(/*y, x*/);\r\n\r\nvar bounds = naver.map.LatLngBounds.bounds(pointToAdd1, pointToAdd2 /*, ... */, pointToAddN);\r\n\r\nmapObj.fitBounds(bounds);\r\n```\r\n\r\nOf course, this also can be animated.  (instead of `fitBounds`)\r\n```js\r\nmapObj.panToBounds(pointsBounds);\r\n```\r\n\r\nI hope this helps."}}
{"actor":{"display_login":"junthus"}}