I am working with google map. According to requirements i need to set different zoom level that is dependent to my search query.If there are multiple location on the map in country then map should focus the country. Other scenario is , if there are different locations marked in a city then map should be focused to city level.
标签:
google-maps
相关问题
- How do you change the color of the dotted line on
- draw polylines with different colors on v2 maps
- Add HTML class/ID to Google Maps Marker (API V3)
- Cannot resolve method “getMapAsync”
- How to add a “hole” to a Circle Polygon (Google Ma
相关文章
- Avoiding “Sorry, we have no imagery here” with Goo
- Custom Marker performance iOS, crash with result “
- Google Map Gradient Polylines for Android?
- Angular 6 - @types/googlemaps/index.d.ts' is n
- Google Maps - Get Polygon border of zones/neighbor
- Google Map Marker Clickable Area
- getSupportFragmentManager().findFragmentById retur
- MapActivity cannot be resolved to a type
After you perform the search, once you have the locations, you can use
bounds.extend
andmap.fitBounds
so the map automatically zooms to show all the pins returned by your search, like this:On the other hand, if you do a search for a zone like zip code, city or country using the geo coder, you can also use
map.fitBounds
to set the viewport to show the entire specific zone that was returned by the geo coder, like this:Here's a codepen with the geocoder example https://codepen.io/jaireina/pen/gLjEqY
I think the key part of this for you is
I found following article very helpful. using code sample code I can able to achieveenter link description here this.
I tried the code in drupal and it is working.