google-maps-api-3

Include open infowindows within bounds of map, when using fitbounds

╄→尐↘猪︶ㄣ 提交于 2019-12-28 23:26:22
问题 I have a map which contains multiple markers with infowindows. The infowindows need to be open on page load. The map is being centered using setbounds to incorporate all of the markers, which works, but it also needs to include the infowindows within the bounds. Currently the infowindows are cropped in places. JS: function initialize() { var map = new google.maps.Map(document.getElementById('map-canvas')); var bounds = new google.maps.LatLngBounds(); var myLatlng1 = new google.maps.LatLng(51

retrieving lat/long of location using google.maps.geocoder

限于喜欢 提交于 2019-12-28 16:42:08
问题 i have been trying to use some ajax to save venue location in my application and stumbled across the following code on stack overflow function getLatLong(address) { var geocoder = new google.maps.Geocoder(); var result = ""; geocoder.geocode( { 'address': address, 'region': 'uk' }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { result[lat] = results[0].geometry.location.Pa; result[lng] = results[0].geometry.location.Qa; } else { result = "Unable to find address: "

Facing the targeted building with Google StreetView

笑着哭i 提交于 2019-12-28 07:06:06
问题 My question is very straightforward. I need the heading value to know how to target the POV. sv.getPanoramaByLocation() in this case returns a data variable containing the heading of both the arrows in which direction you can go further. However it doesn't give me the heading value for which way to look at the building. However it is possible to use a marker in streetview to target your building! example Can anyone help me with this? I can make whatever dump you people want. 回答1: Geocode the

Google Maps API - only one infowindow open at once

喜欢而已 提交于 2019-12-28 07:05:11
问题 Here is the map I am working on. I'm trying to have only one infowindow open at a time, and the open infowindow will close when the map or another marker is clicked. I know this has been asked and answered several times already, but I've attempted to go through those examples and can't figure out how to apply them to my specific code, which pulls photos from Flickr and puts them in infowindows tied to markers. I'm pretty sure the solution involves creating a single infowindow and changing its

Google Map API v3 shade everything EXCEPT for polygon

白昼怎懂夜的黑 提交于 2019-12-28 06:40:10
问题 So by now we're familiar with adding shapes to a Google map with the v3 API: $j('#map').gmap('addShape', 'Circle', { 'strokeWeight': 0, 'fillColor': "#008595", 'fillOpacity': 0.25, 'center': result[0].geometry.location, 'radius': 1500, 'clickable': false }); The above code will create a circle and shade it with fill #008595. Is there any way to inversely shade a map? I would like the entire world to be shaded/filled at half opacity except for a hole where my markers are. Possible? 回答1: you

Display multiple routes on google map

送分小仙女□ 提交于 2019-12-28 06:32:15
问题 I am trying to show multiple routes on google map but It is showing only one. Can you please what I am doing wrong? <div class="searchmap" style="float:left;margin-left:1%" id="map"></div> var map = null; var markerPoints = []; var directionDisplay; var directionsService = new google.maps.DirectionsService(); function initialize() { directionsDisplay = new google.maps.DirectionsRenderer(); map = new google.maps.Map(document.getElementById("map"), {scrollwheel:false, mapTypeId: google.maps

Disable click behavior of POI markers in Google Maps JS API

强颜欢笑 提交于 2019-12-28 06:29:12
问题 As of Google Maps API v3.6, maps now include "points of interest", which are gray markers embedded into a map. When the user clicks on this icon, an InfoWindow appears with information about that business (or park, hospital, etc.) These can be turned off by setting the Styling. (See "Style Array Example") https://code.google.com/apis/maps/documentation/javascript/styling.html Once they are turned off, the icons, names, and shaded regions (for parks and hospitals) go away. Before Google Maps

Animating Multiple Markers

时间秒杀一切 提交于 2019-12-28 06:26:28
问题 I have several markers on a map with polylines drawn. I would like to move each marker along the path of the polyline to simulate simultaneous movement of each marker. I am having problems doing this I am getting only the last marker to move and the rest doesn't. Being new to the use of this programming technology I think something is wrong with my code especially the way I attempt to animate each marker. I need some guidance on this. Here's my work thus far: Jsbin DEMO var startLoc = new

How to get point coordinates of a modified drawingManager shape? GoogleMaps API v3

孤人 提交于 2019-12-28 05:55:46
问题 I have this DrawingManager Object: drawingManager = new google.maps.drawing.DrawingManager({ drawingMode: google.maps.drawing.OverlayType.POLYGON, markerOptions: { draggable: true }, polylineOptions: { editable: true }, polygonOptions: polyOptions, map: map }); And when a Polygon is completed I get their coords with: google.maps.event.addListener(drawingManager, 'polygoncomplete', function (polygon) { var coordinates = (polygon.getPath().getArray()); console.log(coordinates); }); But if I

remove route with google map

你。 提交于 2019-12-28 04:22:04
问题 I got a small app that use the Direction Service feature of Google Map. It is working well, I can change routes, but I have a small problem, where a user could go back to a list of markers after tracing a route. I can't find a way to delete routes with google map. For markers I store them and do setMap(null) , do not see a way here... 回答1: if you are using DirectionsRenderer to display the routes, you can call setMap(null) on it too. That way you delete the displayed route. Using the example