treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Google Maps store locator library for api v3 - fusion tables?

  • hi,

    I would like to utilize the store locator library that google has published for google maps api v3. I have not found much documentation or any tutorials on how to implement my own data. They have a reference page, but it does not show me how i can use other sources. I am pretty new to javascript so i might be missing something. I see in the examples that i can plug data in from the source of my choosing, but only see them using a csv file in the examples. I would like to use fusion tables so i can enter more location markers in the future via a google form. Do you have any idea or know of any tutorials that would help me figure it out? Also, if you have any thoughts on my way of building a store locator for a website, i am all ears.

    thanks!

    Chris

  • I know it's not what you're quite looking for, but here's a really easy way to add as many points necessary by just using Google's API in Javascript. You can easily get the co-ordinates from the web too.

    http://jsfiddle.net/XAeTA/1/

    jQuery:

    // initialize your map as normal
    var options = {
        center: new google.maps.LatLng(55.378051, -3.435973),
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        zoom: 5
    };
    var map = new google.maps.Map(document.getElementById('map'), options);
    
    var coords = [
        [54.97784, -1.612916],
        [55.378051, -3.435973],
        [58.97784, -1.612916],
        [53.97784, 2.612916],
        // Add additional co-ordinates as needed. 
    ];
    
    for (var i = 0; i < coords.length; i++) {
        (function(coord) {
            var latLng = new google.maps.LatLng(coord[0], coord[1]);
    
            var marker = new google.maps.Marker({
                position: latLng,
                map: map
            });
        })(coords[i]);
    };​
    
    
  • James,

    I appreciate that. I am at the point where i can do that, but I would like to go the extra mile to set this up so other people that are not computer saavy can input data with a form. The data rows will have a good amount of fields and images as well.