how to map missing U.S. territories

132 views
Skip to first unread message

Stanton F

unread,
Oct 26, 2014, 4:06:31 PM10/26/14
to google-visua...@googlegroups.com
i'm trying to render a heat map of the U.S. and i am having no luck rendering data for the following entities:

Guam
U.S. Virgin Islands
Puerto Rico

any help would be appreciated.

code to render is pretty much boiler plate.  i can render the U.S. 50 state map fully colorized fine.  i even added the data for the above three regions and they do not render anywhere.  i then tried to render them separately as stand alone maps (i had to do this for District of Columbia, which does work fine).

TIA

== stanton

here follows an example of the code that does not render (renders a "map not available" widget in the page)

                function drawRegionsGuamMap()
               
{
                   
var data = google.visualization.arrayToDataTable([
                       
['State', 'Popularity'],
                       
[ 'US-GU', 5 ]
                   
]);

                   
var options = {
                        resolution
: 'provinces',
                        displayMode
: 'region',
                        region
: 'US-GU',
                        legend
: 'none',
                        colorAxis
: { colors: ['white',
                               
'red',
                               
'purple',
                               
'orange',
                               
'yellow',
                               
'cyan',
                               
'blue',
                               
'green'
                           
] }
                   
};

                   
var chart = new google.visualization.GeoChart(document.getElementById('regions_guam_div'));

                    chart
.draw(data, options);
               
}


Stanton F

unread,
Oct 26, 2014, 4:55:30 PM10/26/14
to google-visua...@googlegroups.com
answering my own question.  figured it out with trial and error.

basically had to use resolution: 'countries', and also explicitly list the values attribute to prevent interpolation which resulted in guam being colored 'green' regardless of the value it represented.

                function drawRegionsGuamMap()
               
{
                   
var data = google.visualization.arrayToDataTable([
                       
['State', 'Popularity'],

                       
[ 'GU', 5 ]
                   
]);

                   
var options = {
                        resolution
: 'countries',
//                        resolution: 'provinces',
                        displayMode
: 'region',
                        region
: 'GU',
                        legend
: 'none',
                        colorAxis
: {
                            values
: [ 0, 1, 2, 3, 4, 5, 6, 7 ],

Ryan Anderson

unread,
Oct 5, 2018, 3:33:59 PM10/5/18
to Google Visualization API
Did you ever manage to get the Virgin Islands (US - only)?  Using 'VI' returns the british islands as well. 

Ryan
Reply all
Reply to author
Forward
0 new messages