Using Google Maps API v3
I have a map with the countries coloured using polygons from a Fusion Table Layer. When a polygon is clicked it opens the default Fusion Table info window which has been configured in the web interface.
Some of the countries can't be seen at certain zoom levels so I'd like these countries to have a polygon AND marker, which when clicked open the default Fusion Table info window. I did add a standard map marker but there is no way to open the Fusion Table info window when clicked.
I've read through the docs and looked at the examples but can't see how this is achieved. Is this possible?
Managed to get this working.
I created a second Fusion Table layer and instead of selecting the KML column I selected the Longitude column with a WHERE clause specifying the smaller countries. This renders a layer with markers on the smaller countries which sits on top of the polygon layer.
The only downside is that both the polygon and marker are both clickable which could open duplicate default Fusion Table info windows. Not a major problem though.
You can't access the "default FusionTables infowindow" from an external click event. You can query the FusionTable from your page and display an infowindow containing the same information on a click on a Google Maps API marker (or a sidebar entry).
Example (opening infowindow from sidebar click, not a marker, as you didn't provide an example)
Related
I'm currently making a custom map using the Google Maps API. So far I have inserted a kml layer using geoXml3, and have written the code to determine if the location of the marker (dropped by an autocomplete address search) is contained within the kml boundary.
Unfortunately I seemed to forget that the marker drops on the street outside the building, not the building itself. This is important as the kml layer is over buildings, and doesn't bleed on to the street.
Is there a way to get the marker to drop on the building instead of the street? If not, are there any alternative ways I could complete what I'm trying to achieve?
Cheers.
I have a google map that uses a fusion table layer for dynamic styling of a large number of Polygons. On top of this layer, I'm also generating a set of markers at specific LatLng positions within the polygons themselves. I'm looking to have the following behavior:
When you click anywhere on a polygon, an infoWindow should pop up, populated by data from the fusion table. This is working.
When you click on a marker, it should pass the click event through to the fusion table layer and create the same popup as if a natural click occurred at the LatLng of the marker. This is what I'm struggling with, and isn't currently working. I'm adding a click listener to each marker, then using that to trigger a click on my fusion table layer, more or less as suggested here:
Here's the code I'm using to add a listener to each marker:
function addMarkerListener(city, LatLng){
google.maps.event.addListener(city, "click", function(e) {
google.maps.event.trigger(layer, 'click', {
latLng: LatLng
});
});
}
In this case, layer is my fusion table layer.
Using this, the click triggers, but I don't actually get any of the data from my fusion table (stored in the row variable of the mouse event object). Instead, my mouse event is passed directly though to my listener on the fusion table layer that would normally handle clicks.
How can I create a click event on the fusion table layer, programmatically, that will pull data from the fusion table as a natural click would?
This is an example of Fusion Table Layer that click markers from sidebar programmatically.
See the entire code from this page.
http://googlemaps.googlermania.com/google_maps_api_v3/en/fusion-tables-sidebar.html
I wonder is there a way to automatically pop up the infoWindow of a marker provided a coordinate. I want to click a link on the page from which I will get a geolocation, (and this location has already been marked on the map) With this coordinate, the corresponding infoWindow will pop up just like I clicked it on the map. Does anyone have a clue how to do that?
Thanks.
--
Generally, it's like what you can do with Google Maps, if you have multiple locations on the left, you click one, the corresponding marker on the map will pop up an infoWindow.
It's possible, all you need is a reference to the related marker, then you may trigger a click on the marker, and the infoWindow will open.
How to get the reference to the marker depends on your application(the way you create the markers and the links)
currently I am work on the project by using polygons KML and fusion table
I have uploading the kml into fusion table and share it, by using the mao id, in my custom web page, they are display correct,
now I need add address search function in to custom page, my goal is display the kml polygon information and the search result information into one information window,
I could display the marker address info and I could by click to display the polygon info window, but they are separate and could not display in one inforwindow
I need to display a set of markers on a google map. In addition, I need to show additional markers, loaded dynamically, when the user pans the maps.
The number of markers could be in thousands, out of which 30-50 need to be displayed initially. Other markers need to be loaded and displayed only when user pans over an area that contains markers. I thought about using marker managers but i am not sure if markers can be fed to the marker manager dynamically. I want something more like this map. Notice how images load when you pan the map and garbage-collected when you pan away.
Marker clustering is not important but might be nice.
I am doing this with clustering on a dataset of several thousand markers. This is how I'm doing it: When the 'moveend' event is fired, I get the bounds of the map and send an ajax request to the server. I get the markers from your DB which are in the bounds and send them back to the client. If you have questions about a specific part of the process, just let me know.
Also, with the Marker Manager, I believe that you can add markers dynamically.