google-maps-api-3

Google Maps Polyline click between points

安稳与你 提交于 2021-01-28 11:43:11
问题 Using Google Maps api 3, I have a polyline with a click event. I need to find out between which two points in the path the user has clicked. Ideally the index of the points. Below is a sample page mostly taken direct from google docs, but added the click event. The actual app has much more complex polylines. Is there are way to do this? Many thanks <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Polylines</title>

Google maps - multiple markers with unique infowindows

半腔热情 提交于 2021-01-28 08:02:54
问题 I am creating a map for users on my website. The way it works is I use PHP and AJAX to get all the sites users addresses, I then pass these values to my JS as JSON where I generate a google map centered around the current users address with a marker for each user on the map. This part works at the moment but what I'm struggling with is generating a unique infowindow for each user. As it is right now I get the same info window for all markers, how can I fix this? JS jQuery(document).ready

How to separate a special marker from a cluster in Google maps?

邮差的信 提交于 2021-01-28 07:30:16
问题 I am using Javascript Google Maps API V3. There is a special marker in one cluster, but I want it always to be shown outside the cluster. Does anyone know how to do this? 回答1: You can do that in the following way: // create your marker var marker = .... // mark your special marker var markerToRemove = marker; // create marker clusterer markerClusterer = new MarkerClusterer(map, markers, { maxZoom: zoom, gridSize: size, styles: styles[style] }); // remove your special marker from cluster

How to separate a special marker from a cluster in Google maps?

风格不统一 提交于 2021-01-28 07:06:29
问题 I am using Javascript Google Maps API V3. There is a special marker in one cluster, but I want it always to be shown outside the cluster. Does anyone know how to do this? 回答1: You can do that in the following way: // create your marker var marker = .... // mark your special marker var markerToRemove = marker; // create marker clusterer markerClusterer = new MarkerClusterer(map, markers, { maxZoom: zoom, gridSize: size, styles: styles[style] }); // remove your special marker from cluster

Basic KML with Google Map API not working

孤街醉人 提交于 2021-01-28 07:05:30
问题 I tried my first Google Map API with KML and it bombed on me. Just seem to be a very basic problem but just can't get it to work. Here is the script tag: <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"> </script> Here is the Javascript: $(document).ready(function () { map_center = new google.maps.LatLng(-34.397, 150.644); var mapOptions = { zoom: 8, center: map_center }; var kml_map = new google.maps.Map(document.getElementById('map_div'),

Google Maps V3 -> Is it possible to trigger the on click event on a specific coordinate (lat, lng) programmatically

牧云@^-^@ 提交于 2021-01-28 01:48:09
问题 This question is related to my question here: Google Maps V3 -> Is it possible to get properties from Geojson using lat lng coordinates or other information from search box? Since it is possible to trigger a click event programmatically like this, I'm wondering if I can trigger a click event on a given lat/lng position in the same way? Example code: google.maps.event.trigger(marker, 'click'); Pseudo code of what I would like to do: google.maps.event.trigger(place.geometry.location, 'click');

google maps api v3: handle user click on map type control?

十年热恋 提交于 2021-01-28 01:11:21
问题 I need to handle the case when a user clicks on a mapTypeControl differently than when it's set through map.setMapTypeId() . How do I listen for clicks on map type controls? 回答1: You can't listen for events on the default UI control set. But if you are strictly focused on differentiating between clicks on the mapTypeControl and map.setMapTypeId() , you could use the fact that you control the code that may call setMapTypeId() and add some state management code: // First, add a new state var:

How can I remove marker with bonded circle from the map?

岁酱吖の 提交于 2021-01-27 22:24:25
问题 I did bind the circle with marker to make view like: But when I try to remove marker from the map, the circle still exists. Hmm, How can I remove marker with circle? Relevant code: function removeMarker(){ if(selectedMarker) selectedMarker.setMap(null); } .... function createCircle() { var circle = { strokeColor: "#006DFC", strokeOpacity: 0.4, strokeWeight: 2, fillColor: "#006DFC", fillOpacity: 0.15, map: mapA, center: selectedMarker.getPosition(), radius: 50 // in meters }; var cityCircle =

Google Maps API V3 Tiles Not Rendering - Whats the Deal?

核能气质少年 提交于 2021-01-27 22:20:38
问题 I am trying to load a map that has a very zoomed in view, with a height of about 8500px and width of only about 400px. When the map loads, some of the top and bottom tiles do not show. If, after the map loads, I zoom out, and back in, it will display, but there are still issues with rendering things like labels and markers on the top and bottom sections. Here is the jsFiddle that recreates the problem (scroll down in the results) as well as the js for my map initialize function: function

external link to google map marker

本秂侑毒 提交于 2021-01-27 20:15:22
问题 I'm trying to make an external link that pulls up the info bubble of a marker and centers it. I wanted to do it by referencing a div ID that I called clickaway, this is what I set up but can't seem to get it working: <script> function initialize() { var myLatlng = new google.maps.LatLng(-25.363882,131.044922); var mapOptions = { zoom: 4, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); var