Skip to content

Google maps

Mathias Rangel Wulff edited this page Jun 11, 2015 · 7 revisions

Google Maps + AlaSQL

Pinpointing data on a map should be easy. Here is an example of AlaSQL used to prepare source data for Google Maps

    alasql("SELECT * FROM CSV("https://cdn.rawgit.com/albertyw/avenews/master/old/data/average-latitude-longitude-countries.csv",{headers:true}) WHERE Latitude BETWEEN 25 AND 50', [], function(country){
        var mapOptions = { zoom : 3, center : new google.maps.LatLng(40, 0),
            mapTypeId : google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
        for (i = 0; i < country.length; i++) {
            var opts = {
                strokeColor : '#000000',
                fillColor : ["red","green","blue","brown"][i%4],
                fillOpacity : 0.35,
                map : map,
                center : new google.maps.LatLng(country[i].Latitude,country[i].Longitude),
                radius : 100000
            };
        new google.maps.Circle(opts);
    });

You can play with an example or poke around with this other example of intergrating AlaSQL and Google Maps

Clone this wiki locally