{"action":"closed","issue":{"url":"https://api.github.com/repos/tombatossals/angular-leaflet-directive/issues/932","labels_url":"https://api.github.com/repos/tombatossals/angular-leaflet-directive/issues/932/labels{/name}","comments_url":"https://api.github.com/repos/tombatossals/angular-leaflet-directive/issues/932/comments","events_url":"https://api.github.com/repos/tombatossals/angular-leaflet-directive/issues/932/events","html_url":"https://github.com/tombatossals/angular-leaflet-directive/issues/932","id":105752306,"number":932,"title":"fit layer bounds","user":{"login":"cyrilchaponeverysens","id":13692268,"avatar_url":"https://avatars.githubusercontent.com/u/13692268?v=3","gravatar_id":"","url":"https://api.github.com/users/cyrilchaponeverysens","html_url":"https://github.com/cyrilchaponeverysens","followers_url":"https://api.github.com/users/cyrilchaponeverysens/followers","following_url":"https://api.github.com/users/cyrilchaponeverysens/following{/other_user}","gists_url":"https://api.github.com/users/cyrilchaponeverysens/gists{/gist_id}","starred_url":"https://api.github.com/users/cyrilchaponeverysens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyrilchaponeverysens/subscriptions","organizations_url":"https://api.github.com/users/cyrilchaponeverysens/orgs","repos_url":"https://api.github.com/users/cyrilchaponeverysens/repos","events_url":"https://api.github.com/users/cyrilchaponeverysens/events{/privacy}","received_events_url":"https://api.github.com/users/cyrilchaponeverysens/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-10T07:56:08Z","updated_at":"2015-09-22T14:08:13Z","closed_at":"2015-09-22T14:08:13Z","body":"I'm trying to find a way to fit my map to a layer bounds. So basically what is the best strategy for this ?  \r\nI know how to get bounds from a layer, ie `layer.getBounds()`, and how to fit map to bounds, ie `map.fitBounds()`; but if I know how to get the raw leaflet map with `leafletData.getMap().then()`, I have no clue how to retreive my raw leaflet layer (from name, maybe ? With an *angular-leaflet* helper ? With a raw `map.FUNCTION()` ?). Plus, isn't there a best (angularish) way to accomplish that ?\r\n\r\nSame question for fitting multiple layers at the same time, I'd like to group my layers in a layergroup, and achieve the fitbounds on this layergroup.\r\n\r\nThanks =)"}}