Benjamin Soddy
Benjamin Soddy

Reputation: 577

Google Charts Map Visualization with addresses

Using the Map Visualization data format, I cannot seem to be able to get a map sourced from an address string.

Geographic coordinates, similar to those provided in the example work perfectly, but addresses will not result in a rendered map.

Here is a sample of both a functional geographic coordinate map and a non-functional address map. The address DataTable and Map declaration are seemingly valid according to the documentation, but result in the cryptic console error: "Uncaught InvalidValueError: unknown property kS".

google.load("visualization", "1", { packages: [ "map" ] });
google.setOnLoadCallback(drawMaps);
function drawMaps()
{    
    var geoDataTable = google.visualization.arrayToDataTable(
    [
        [ "Latitude", "Longitude" ],
        [ 40.748298, -73.985541 ]
    ]);
    var geoMap = new google.visualization.Map(document.getElementById("geoMap"));
    geoMap.draw(geoDataTable, { showTip: true });

    var addressDataTable = google.visualization.arrayToDataTable(
    [
        [ "Address" ],
        [ "350 5th Ave, New York, NY" ]
    ]);
    var addressMap = new google.visualization.Map(document.getElementById("addressMap"));
    addressMap.draw(addressDataTable, { showTip: true });
}

Upvotes: 1

Views: 950

Answers (1)

Related Questions