google-maps-api-3

Multiple google map polylines

左心房为你撑大大i 提交于 2020-01-14 05:49:08
问题 I'm trying to use this code to do what I'm needing, which is to have multiple polyline origins and destinations on my map, with the ability to click on the origin marker to display text about the route. The problem with this example is the destination is only one lat/long, but I need to add the different destination lat/longs for each origin, as well as unique marker text/title for each. Can anyone show me how to do this? Thanks for your help. <html> <head> <style type="text/css"> html {

Google Maps: set custom color for type of markers

孤人 提交于 2020-01-14 05:40:10
问题 I'm trying to set colored markers in Google maps, so that every location type has its own color. var markers = [ ['Buy Jeans', latitude,logitude,'store'], ['Eat well', latitude,logitude,'restaurant'], ['Get drunk', latitude,logitude,'bar'] ]; Below is how we run through the available markers. But I can't figure out how to give 'store' a red pin, 'restaurant' a blue pin and 'bar' a green pin for( i = 0; i < markers.length; i++ ) { var position = new google.maps.LatLng(markers[i][1], markers[i]

creating an SVG marker on click event

不打扰是莪最后的温柔 提交于 2020-01-14 05:04:52
问题 Now that I can actually create an SVG marker here is my vision: The user clicks on the map, the click fires an Ajax query which retrieves "length" and "angle" values from a remote server, and using those values, and SVG arrow of the given lenght and angle is drawn at the click. The Ajax part is easy, and once I have a length and angle, I can figure out the SVG syntax for an arrow. For now, I am trying to create the "click and create a random arrow". The code below kinda works. An arrow gets

Creating Google Maps Clusters by type

自古美人都是妖i 提交于 2020-01-14 04:44:26
问题 I would like to know if it is possible to cluster markets on Google Maps not only by density or number, but also by type. For example: I have 20 markers of type A and 50 of type B. Could I have a two different clusters, one grouping all the type A markers and another one with type B markers. Obviously with different icons. Another possible solution would be a single cluster that its icon would change depending of the number of markers of type. For example: if we have 20 markers type A and 50

Fancybox infowindow Google Map

感情迁移 提交于 2020-01-14 04:35:15
问题 I want to know how to open a fancybox popup when clicking on a marker in google map. I know that this question has already been asked but the answers are wrong or unanswered. Many people would like to know the technique to do this even though I think very few people have the answer ... So it would be very nice from you if you have a clear and precise answer. Here is an attempt I made, but that does not work. <script type='text/javascript'>//<![CDATA[ $(function(){ function initialize() { var

Retrieving JavaScript's eventObject when using Google Maps API listener

て烟熏妆下的殇ゞ 提交于 2020-01-14 04:25:23
问题 In google maps API V3, I would like to add a marker to the map if the user control-clicked the map. For that, I've added a listener to the map, as follows - google.maps.event.addListener(map, 'click', function(e){ if (event.ctrlKey) add_marker(e.position); }); The e parameter, passed by the listener, contains some data, but mostly regarding the position of the click, while I want to be able to ask if the control button was pressed during the time the usser clicked on the map. I found that

Multiple Google Autocomplete and Places Search Issue

时间秒杀一切 提交于 2020-01-14 03:32:11
问题 I am in need of some help regarding Google Maps API and using Autocomplete and Address complete. This is currently my code: JS function fillInAddress(show) { console.log(show); var place = autocomplete.getPlace(); for (var i = 0; i < place.address_components.length; i++){ var base = place.address_components[i].types[0]; if(base === "postal_code"){ console.log(place.address_components[i].long_name); } } } function initialize(out) { autocomplete = new google.maps.places.Autocomplete( (document

Meteor Google Maps Autocomplete only works once on multiple templates

可紊 提交于 2020-01-14 03:23:05
问题 I am using a Google Places autocomplete package with Meteor and if I have the user select a location in one template, the autocomplete won't work again in a different template. For instance, if the user picks an autocomplete location for an event they are hosting, and then they try to set their profile location in the profile settings, no autocomplete locations pop up. In fact, if they even activate the autocomplete dropdown on one page (without even selecting one of the options), it won't

How to load google maps libraries dynamically

倾然丶 夕夏残阳落幕 提交于 2020-01-14 02:23:05
问题 I know I can load libraries in google maps api v3 using libraries argument in URL. Now I am in the situation where I cannot change the html markup, only javascript. Can google maps libraries be loaded dynamically using some javascript call, e.g. by calling some google api function? E.g. something like google.load() . 回答1: I know this question is rather old, but I had the same problem recently. In my case I couldn't easily change the script-load-url but attach js-code afterwards. Double

Prevent tampering with client-side geocoding results

梦想与她 提交于 2020-01-13 22:42:08
问题 We are building a service that uses location-based pricing. The user can input an address and see prices in his area as determined by various server-side algorithms. It is then possible to order items based on these prices. I'm trying to figure out if there is a way we can use client-side geocoding in this scenario (to avoid hitting Google Maps API usage limits), e.g. the user enters his address and the browser fetches the geocode result using the JS library and includes it in the form