Question

I am currently doing a tracking application and am using Google maps fusion table to display the geocoded data. its very fast and easy to use but I am having some problems to zoom and pan the map according to where user clicks on a external JavaScript link. I am using data from royal mail to display polygons depending upon users point of interest and now I need to be able to display info window based on click event generated from a external link. I can get the latlng from the area user wishes to view and generate my own info window but its not always in the centre of the polygon.

My questions now are:

Is there any way i can trigger the default info window from fusion tables by clicking on external JavaScript link?

Can I centre and zoom the map based on users choice of area by querying fusion tables?

I would appreciate if any body knows the solution or provide me some pointers regarding how do I achieve this functionality in my application.

Thanks Bikash

Was it helpful?

Solution

Well long enough since i asked the question, i thought it would be better if i could answer at least the workarounds, i of course didn't find the solution but achieved what i needed with some techniques:

The answer to my first question is no, there is no default or inbuilt method for your application to open an infowindow in a google maps fusion layer from external link, but if you need it, its a simple trick, on your database or at least on fusion tables you need to have the infowindow content, and based on where user clicks on a layer you can create listener that gets the row id of the layer and gets the content of infowindow and display it on the lat, long you wanted

listener=google.maps.event.addListener(layer, 'click', function(e){
var rowId= e.row['id'].value ;
//use rowId to query fusion tables or your database and display results to the user
//simple ajax should be able to handle this 
});

The answer to my second question is again no, but there are several workarounds for this as well, one technique that I followed is:

Allow the siteadmin to save on the database the center and zoom level for each of the area where user may what to perform their query, later when user performs any query that needs map to be centered, just use the center latlng and zoom level set by the admin and display maps.

This is how i achieved what i needed to, if anyone has a direct solution, would be great but there are always workarounds to perform a task.

Thanks Bikash

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top