google-maps-api-3

Getting the bounds of a polyline in Google Maps API v3

房东的猫 提交于 2020-01-02 03:31:08
问题 Is there any easy ways to find the bounding box of a polyline using Google Maps API v3? I'm working on a project where I need to update the bounds as data is added and removed from the map. This is pretty easy by just doing bd.extend(point) where bd is the bound object and point is a LatLng object. The problem is when I start removing data I would like it to change the bounds and zoom back in. Are there any built in functions that can do this or will I need to write something for myself? 回答1:

Alternative to Google Maps API Radar Search

十年热恋 提交于 2020-01-02 03:24:06
问题 With Radar search being taken off, are there any other alternatives that Google has proposed (or any other source, if not Google) to get information on all businesses in a given location. In the end I am interested in obtaining a list of all business in a city, say Delhi, legally (I guess web scraping Google Maps would be illegal). Google Maps Radar Search - https://developers.google.com/places/web-service/search Thanks for the response. 回答1: From https://maps-apis.googleblog.com/2017/06

Is there a way to override the Google Directions service zoom values?

落花浮王杯 提交于 2020-01-02 03:19:10
问题 I'm using the code below to get the route between two points: directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } } It's working fine, but I don't want to change my map position and zoom level when drawing route. So when I call the code above with different latitude and longitude values, I would like my map position and zoom level to be maintained. Any idea? 回答1: When you create the

Google Maps Javascript API V3 - How to remove Custom Control?

和自甴很熟 提交于 2020-01-02 02:43:13
问题 I have created custom controller by following http://code.google.com/apis/maps/documentation/javascript/controls.html Is there any way to remove custom controller? is it possible to use setOptions() for this? 回答1: you can remove using this two function using removeAt() or clear() should accomplish the task. or by it's position in MVCArray map.controls[position] is an MVCArray . http://code.google.com/apis/maps/documentation/javascript/reference.html#MVCArray 来源: https://stackoverflow.com

How to get the MapOptions object from a map with Google Maps API v3

99封情书 提交于 2020-01-02 02:34:20
问题 In Google Maps api v2 you could get parameters such as the map type, zoom etc directly from the map object. In version 3 you have the setOptions method to set some parameters, but there is no getOptions() or options to retrieve them. 回答1: You can access those properties via methods on the Map class: getZoom() getMapTypeId() getCenter() etc.. 回答2: You can also access options using the get method on the map as an MVCObject as shown in this example // create map var myLatlng = new google.maps

How to move the center position of google map

女生的网名这么多〃 提交于 2020-01-02 02:32:27
问题 I am creating a google map in a script with the following code - var mapElement, parent, mapOptions, map, marker, latLong, openMarker; parent = document.getElementsByClassName('parent')[0]; mapElement = document.createElement('div'); latLong = new google.maps.LatLng(some_lat_from_db, some_long_from_db); mapOptions = { center: latLong, zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(mapElement, mapOptions); marker = new google.maps.Marker({ position: latLong,

Google-Maps v3: How to change the map style based on zoom level?

删除回忆录丶 提交于 2020-01-02 01:45:48
问题 I am using the new Google Maps v3 STYLED MAP. I want to change how the map is Styled based on the zoom level. I have the following pseudo-code, how do change my map-style based on the zoom level? var myOptions = { zoom: zoom, center: latlng, disableDefaultUI: true, navigationControl: true, scrollwheel: false, navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL,position: google.maps.ControlPosition.TOP_RIGHT}, mapTypeId: google.maps.MapTypeId.ROADMAP }; var

How do I get Google Maps “Places API” to return ZIP code information?

*爱你&永不变心* 提交于 2020-01-02 01:07:11
问题 How do I get Google Maps "Places API" to return ZIP code information? In all the examples I find on the internet, none of them show results returning that contain a ZIP code. Is there a trick to this or is it not possible? 回答1: This seems like it's returning a "postal code" (4 digits for some reason) in the address_component section: https://developers.google.com/places/documentation/#PlaceDetailsRequests However, I think what you're looking for is the Google Geocoding API: Geocoding is the

How to change strokeColor between points when using DirectionsRenderer

蓝咒 提交于 2020-01-01 19:56:11
问题 I'm using react-google-maps to render map in website. I have a problem about strokeColor for each line when using waypoints for DirectionsService. How to change strokeColor between them and how to callback after using DirectionsService . This is my source same example: https://tomchentw.github.io/react-google-maps/#directionsrenderer let DirectionsService = new google.maps.DirectionsService; var directionsDisplay = new google.maps.DirectionsRenderer; DirectionsService.route( { origin: new

Cluster Marker Google Maps using geoCoder

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 19:34:06
问题 Using this data var data = { 'address': [ { 'address': '7970 GLENTIES Ln' }, { 'address': '8022 Caminito Mallorca' }, { 'address': '2750 Wheatstone St # 26' }, { 'address': '335 49th St' } ] }; i manage to marker them but i was unable to cluster them. below the code that I've use. var markerArray = []; function initialize() { geocoder = new google.maps.Geocoder(); var center = new google.maps.LatLng(37.4419, -122.1419); var map = new google.maps.Map(document.getElementById('map'), { zoom: 3,