angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

how to use the map "fit to bounds" property

Open figuerres opened this issue 9 years ago • 4 comments

usin gthe 0.0.17 release i have maps working in general. i need to make the map auto zoom / center based on the map pounts to be shown.

based on the google api and this library it looks like i need to make a "bounds" object and call .extend for each marker i need to show and then set or bind the fitBound property. where i am stuck right now is how to populate the bounds object with the data. i am having issues with how to create the LatLng object . in the code i see an interface that has methods but no class that impliments the interface and the latlng interface says the lat and lng are methods not properties. what am i missing in this picture ??

thanks !

figuerres avatar Dec 27 '16 19:12 figuerres

looks like i am trying to use what is in this issue: https://github.com/SebastianM/angular2-google-maps/issues/781 not sure how to merge this to that or properly mark it....

figuerres avatar Dec 27 '16 20:12 figuerres

Closing in favor of https://github.com/SebastianM/angular2-google-maps/issues/781 then.

lazarljubenovic avatar Jan 19 '17 15:01 lazarljubenovic

I'm also struggling for the same issue as Figuerres mentioned,

Need to make the map auto zoom / center based on the map points to be shown. based on the google api and this library it looks like i need to make a "bounds" object and call .extend for each marker i need to show and then set or bind the fitBound property. where i am stuck right now is how to populate the bounds object with the data. i am having issues with how to create the LatLng object . in the code i see an interface that has methods but no class that implements the interface and the latlng interface says the lat and lng are methods not properties. what am i missing in this picture ??

Could you please provide some sample solution or code snippet to zoom the markers area by using fitbounds?

VaseemMalik avatar Jan 24 '17 14:01 VaseemMalik

@VaseemMalik did you solve this? How did you get a bounds object?

You can easily create a LatLngLiteral with properties as you like,

jimmykane avatar Jun 11 '17 08:06 jimmykane