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

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().

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.

Can you change the view in Google Earth API from "Earth" to "Map" like in Google Maps?

I am developing a web page which uses the Google Earth plugin. I would like to display the map like in the first image with the "Earth" and "Satellite/Map" view options like you can in Google Maps, or at least be able to just show the map in "Satellite/Map" view:
Currently this is what the view looks like:
Is this possible?
Yes, you can use the Google Maps V3 to switch between Google Maps and the Google Earth Plug-in.
The google-maps-utility-library-v3 can be used to make this easier.
You can see a working example here.
Alternatively you can simulate a reasonable map view buy just turning of the terrain and photo imagery and turning on the borders and roads layers in the Earth Plug-in. If you then lock this view to 'plan' it works well.

Dynamically addressing kml in Google Earth API for Google Maps v3

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.

Adding overlays to the Google Maps display itself

I'm looking for a way to add images to the Google Map interface itself, not fixed on a point on the geographical map but on the Google Maps "window". Something to display Map Legends on the map itself.
I've been looking through the net but can't seem to find a way to do this. As you can tell I don't really know what this is called also, so that may be the reason why I ca
You have to open infowindow on map and put image in it.
Try with this answer : google maps api v3 - how to display image thumbnails inside bubble?

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!

Resources