Google Map Pins Missing - google-maps

I have a site using Google map but is now having pins disappear. The code that create the pins are valid and have already been tested. From the inspector, they all seem to be pointing to the a.xa.Fa property in http://maps.gstatic.com/intl/en_us/mapfiles/api-3/13/9/main.js which I believe is injected (as I have included no such script).
I'm quite desperate and have no idea what to do with it. So any input is appreciated.

You try to add markers without supplying a proper pin-argument to add(), therefore the creation of new google.maps.MarkerImage(pin) will fail in add().
This happens the first time at the 6th marker(that's why you see only 5 markers, the error will stop the script-execution at this point).
Solution: you may either fix it(supply a proper pin-argument), there is also a LatLng of 0,0 provided, I guess something went wrong with your data.
or add this to the begin of add() to have a default-pin for these situations:
pin=pin||'http://www.mychinaroots.com/wp-content/themes/mychinaroots/images/8-default.png';

Related

Get a tooltip by mouseover with Fusion Tables

As a beginning self-made amateur programmer I’m currently trying to get some things done with Google Fusion Tables.
I made a map with markers and got the HTML of that map. But I wish to add the function of a tooltip by a mouseover of a particular marker. I found a tutorial to work this out but I can’t enable the tooltips.
The following link shows the progress so far: http://jsbin.com/cipejicewo/1/watch?html,js,output
1 I don’t have to change something in this script that fits to the specific Fusion Table where its linked with, do I? When I do have to change the javascript, what are the specific elements I have to rename?
2 How can i call google.maps.FusionTablesLayer.enableMapTips(options)? And where do I have to put this whole ‘function init’ code in the html-file? Directly in the script that described above? Off course without losing the functions that the html already provides. Besides that, I get that I have to change the tableid and change the select column and geometry column name, but is there something more I should change in this function I'm going to add?
I'm struggeling with it now for days. And I'm out of options, so every help would be welcome. Thanks in advance!
It's not clear what your code currently looks like, but these 2 things you'll need to do first:
when you use another FusionTable than the example, make sure that the table is public and downloadable
You must use your own key(it's the variable apiConsoleKey in the example). Follow the steps in Acquiring and using an API key to get a valid key.

Google Drive Realtime API - Adding Collaborative list

From the documentation, it says I can have a collaborative list which contains other collaborative objects, namely another collaborative list. Therefore in my "onFileLoaded" event, I have the following code:
var myRoot = doc.getModel().getRoot().get('myList');
var newList = doc.getModel().createList();
newList.push('Level2');
myRoot.push(newList);
I understand that everytime I reload the file, a new list will be added to "myList". Everything works fine except when I reload the document, that's when the API will only give me "myList" and the "newList" is gone and disappeared into thin air. If I add a string or any other data, the data will persist when I reload the document, but not adding another list to the current list. What am I doing wrong? Thanks in advance.
I am not sure why the above does not work for me, but when I moved the list adding codes out of "onFileLoaded", specifically, adding list to lists only when I click on some DOM element, everything works fine. I supposed these codes should be out of "onFileLoaded" anyways, so it's all good and hopefully someone find these useful.

I'm getting Invalid argument error when loading google maps in IE

Message: Invalid argument.
Line: 26
Char: 56
Code: 0
URI: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/9/13/main.js
I went through the solutions in Stack Exchange found some thing relevant at
Google Map api v3 - IE7 - main.js error - invalid argument (javascript)
and tried to remove the div for test purpose through jQuery like below
$(".gmnoprint").children().remove();
$(".gmnoprint").empty();
$('.gmnoprint').find("div").slice(1,2).hide().remove();
$('.gmnoprint').find("div").hide().remove();
$(".gmnoprint").children("div:lt(1)").remove();
$('.gmnoprint div:nth-child(1)').remove();
$(".gmnoprint").first().remove();
but no options has worked.
I also had this problem for IE7/8 (didn't try IE6, IE9 worked well), same line and column and same maps api file version.
I figured out that this happened (at least for me) whenever map should be re-rendered on the same page (async approach), and solution was to always remove map node from DOM just before trying to re-render map again, with e.g:
$('#MAP_CONTAINER_ID_HERE').children().remove();
with jQuery (or equivalent with native js),
Also, sometimes the problem may be in an unfinished job from the previous map rendering (assuming that we're discussing issue with maps that are re-rendered on the same page), and IEs<9 seem to be fragile when redrawing over unfinished maps.
That said - maybe you could check another thread (http://stackoverflow.com/questions/8175425/invalid-argument-error-in-ie7-jquery-tabs-and-google-map) dealing with what I just described if removal of nodes representing previous map rendering didn't help.
Finally - if you're experiencing this bug with no map re-rendering then you're probably running into issues with improperly created options or something similar, it would be much easier to respond if some code snippet or at least scenario is given.

Open info window if user hovers longer than x milliseconds

What I'm trying to do is very simple:
open the marker's info window only if the user has hovered on the marker for longer than x millisecond.
I can't find how to do this anywhere. I would appreciate a little code snippet to show me how to set this up!
The jQuery HoverIntent plugin might be able to help you
http://cherne.net/brian/resources/jquery.hoverIntent.html
hoverIntent is a plug-in that attempts to determine the user's intent... like a crystal ball, only with mouse movement! It works like (and was derived from) jQuery's built-in hover. However, instead of immediately calling the onMouseOver function, it waits until the user's mouse slows down enough before making the call.
Actually I finally found the solution to it on the Google Maps Group here: http://groups.google.com/group/google-maps-api/browse_thread/thread/73cf193d42a0bbfe/fa531a39b353d198?lnk=gst&q=open+hover#fa531a39b353d198
Best of luck to all the late night coders out there :)

Window settings for Google Maps widget

I've got a plain-vanilla google maps widget sitting in a page and I'd like it if the driving directions opened up in a new window instead of taking over the current window. Is there a setting for this?
The driving directions go into whatever HTML element you specify as the second argument when you construct the GDirections object. So I guess that means you'd have to create the window before you create the GDirections object, which is likely not what you want.
The other thing that jumps out, looking at the documentation, is that you can call the load() method with the option getSteps = true. It's not clear what the "steps" data looks like, but I assume it essentially comes back as an HTML string. (Actually, it's not even clear how you get the data in the first place, but I assume it's GDirections.getSteps() or something similar.) So then when the "load" event happens, you can create the new window then put the "steps" data in it.