Dynamically addressing kml in Google Earth API for Google Maps v3 - google-maps-api-3

I'm using Google Earth API for Google Maps v3 to display kml files in a window which can then be switched between Maps and Earth browsers. This is a different plugin to that officially provided by Google, and I've run into a problem dynamically switching kml in the Earth window. I use checkboxes to switch them in the Maps API V3, window, but when the browser is switched to Earth it no longer listens to the checkbox actions. Essentially what I'm trying to do is a replication of the interactive checkbox example on the google code playground, but I think I should be using the Maps V3 scripts?
I've included a link to the example script here:
http://commondatastorage.googleapis.com/webgistank/TRMM_Checkbox_Example.html
Any help is greatly appreciated!
Regards,
Kerry

You have errors in your code. For example, the line
google.maps.event.addListenerOnce(map, 'tilesloaded', addOverlays);
references the non-existent function addOverlays
Also, I'm not sure what you mean...
"This is a different plugin to that officially provided by Google"
...as it is the exact same plugin.
You also state that...
"...it no longer listens to the checkbox actions."
It is the browser listens for the actions, not the Earth plug-in. The checkboxs event are still firing, the reason the code doesn't work is that the "Google Earth Api" (the api for controlling the plugin) uses totally different objects and methods to the Google Maps Api (the api for controlling the map). Things like google.maps.KmlLayer just don't exist in the Earth Api at all. So when the checkbox event fires it causes and error because you are calling methods on objects that don't exist.
From looking at your code, after initialising the Earth plugin via
googleEarth = new GoogleEarth(map);
You don't do anything else with it...You mention in your question the interactive checkbox example on the Google code playground, but as far as I can see you haven't actually implemented any of the code from that example.
Take another look at the function loadKml method in that example - it clearly shows how to load and display data in the Earth plugin.

Related

what3words APIv2 UI wrapper with Google Maps

Our website is trying to integrate with both Google Maps and What3words. I need to build an UI display a map with.
A marker on the map, and a search box.
When dragging marker, can retrieve the corresponding 3 words based on its geo coordinate.
When typing into the searchbox, can retrieve the three word based on auto complete result from Google.
Actually it should look like below picture.
What I have archived so far is getting the source code from What3words-map-marker that support What3words API v1 already. But now all the API from What3words has migrated to API v2.
May I check If there are any release from What3words that support wrapper it with Google Maps and API v2?
I'm not sure I follow your question exactly but my company also has just recently implemented something might be the same with your requirement.
Please check this Github page for more detail. Image as below.

How to search only within the displayed map with google maps?

Airbnb has a feature on their main search page that only the results in the map are shown. Is it something that is supported by the google maps api ?
I am using the gem gmaps4rails. I havn't found this in neither in the google maps api not in the gem.
Basically what I want is the bounds of the map so that I know what constraints to search with, so that the results fit in the map.
How do you think it can be done ?
The Map-class has a method called getBounds().

Google maps api marker info in sidebar

I'm currently creating an interactive web map using Google Maps Javascript API version 3. I'm not sure if this is possible but I would like to create a series of map layers consisting of different kml files that could be toggled from the side bar. I would also like to be able to access the individual points within the kmls so that when the user clicks on a particular point, photos, text etc. can be loaded outside the map window...
Any ideas on how to accomplish this? I've been searching for a while and only found ways of configuring the infowindow which I personally find unattractive...
There is a way to load KML into a google maps application natively, there is actually a pretty good example of how this is done here:
http://gmaps-samples-v3.googlecode.com/svn/trunk/layers/layers.html
One trick I will mention is that since the KML is downloaded to Google's servers in order to be rendered on the map, it must exist on a public facing web server somewhere, Google won't be able to access it from your local machine.
I found this tutorial which seems like it'll do the trick!

Google map is not working Properly in ajax request

Hi I have one web application where i am using google map in my site. For Fetching Marker points I am using ajax request. In First time When I am using this it's working perfect but when i tried for second time (ANY refresh). Then it's showing only half google map.
I am using version 2 google map api.
Please help me to find the solution.
Thanks in Advance.
hard to say what is your problem here. You might want to try to redraw the map by using
map.checkResize();
or in google maps api v3:
google.maps.event.trigger(map, 'resize');
But this normaly shouldn't be needed...

Google Maps API: Standart (new) balloon style

How to make standart balloons like new restiled google maps ballons?
See pictures:
New styled balloons:
old styled balloons (i have):
Where i can get css?
Google Maps often put new functionality in their own maps before making them public in their API.
I believe this is a custom info window and there are images involved.
So you can't just put some CSS to style the old balloon into the one you're seeing on Google Maps.
What you have to do is if you want the new styled balloon, you have to create one yourself with the Maps API.
This is called a Custom Info Window
This is pretty intensive if you never did some Maps API development.
If the "new style" balloon becomes popular, they will push the update through a new version of the API so it can be available to everyone. They did this with the zoom control, etc.
I'm a certified Maps API developer so I'm pretty sure of my answer!
Thank you

Resources