GeoChart Countries being displayed incorrectly

50 views
Skip to first unread message

Diogo Ribeiro

unread,
Jun 1, 2015, 7:03:08 AM6/1/15
to google-visua...@googlegroups.com
Hi guys,

Could you help me discover why some countries are being displayed incorrectly?

I have

google.setOnLoadCallback(drawRegionsMap);
     
function drawRegionsMap() {
       
var data = new google.visualization.DataTable();
        data
.addColumn('string', 'Country');
        data
.addColumn('string', 'Name');
        data
.addColumn('number', 'P1');
        data
.addRows([
                   
['DE','Germany', 228]                    ,
                   
['AR','Argentina', 53],
                   
['US','USA', 7746]
       
]);
     
var options = {
        region
: 'world',
        displayMode
: 'markers',
        backgroundColor
: '#B3D1FF',
        minValue
: 0,  colors: ['#A1FF8E', '#008042']
     
};                      
     
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
      chart
.draw(data, options);
};



Both Argentina and Germany are being displayed in USA?

Thanks in advance.

Daniel Buttery

unread,
Jun 1, 2015, 7:42:08 AM6/1/15
to google-visua...@googlegroups.com
Looks like a mixup with Country Codes that match 'regional' codes (DE = Delaware, AR = Arkansas).


GB (UK) works fine as there is no matching regional code, but SE (Sweden) goes to South America. Working fine if you change the country codes to country names, but obviously thats not what you're after. I'm sure someone will swing by soon and let us know if its a bug!

Sergey Grabkovsky

unread,
Jun 1, 2015, 9:44:36 AM6/1/15
to google-visua...@googlegroups.com
Hi Diogo,

For 'markers' mode, we use Google Maps for geocoding the locations (converting a string location to a latitude and longitude), and so ambiguous locations may not get geocoded as you might expect. Because of this, even though we recommend ISO 3166 codes to be used for 'regions' mode, 'markers' mode winds up working best with longer names (like Germany, Argentina, etc) where there is no ambiguity.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Diogo Ribeiro

unread,
Jun 2, 2015, 3:48:09 AM6/2/15
to google-visua...@googlegroups.com
Thanks a lot for your help Daniel & Sergey.

Should I create a bug reporting this issue? I didn't find this information stated in https://developers.google.com/chart/interactive/docs/gallery/geochart#markers-mode-format

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/0VHgOVeFf_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

Sergey Grabkovsky

unread,
Jun 2, 2015, 11:20:29 AM6/2/15
to google-visua...@googlegroups.com
I completely agree that the behavior is not ideal, but we can't exactly do anything to fix it either. I'll file an internal bug to document this better.

Daniel Buttery

unread,
Jun 3, 2015, 6:14:39 AM6/3/15
to google-visua...@googlegroups.com
Hey Sergey. I was hoping to use this chart in a similar way for International data, so thought I'd chime in. :)

Would it be possible to have an option for the chart that forces it to interpret given locations at a certain regional level? For example you could have forceDistrictISO = true; or forceNationalISO=true; . That way us lowly international peeps could ensure that the chart doesn't incorrectly guess what data we're providing.

Thanks!

Dan
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/0VHgOVeFf_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

Sergey Grabkovsky

unread,
Jun 3, 2015, 10:45:56 AM6/3/15
to google-visua...@googlegroups.com
I'm not sure that would be possible. I don't think we can give the Maps geocoder hints like that. I think that one of the things that we could be doing better is to calculate the center of the regions currently being displayed on the map, and allow for markers to refer to them directly, without the need for geocoding. I imagine that this will have a few flaws: the center we calculate might be different from the one Maps returns, resulting in possible inconsistencies with 'FR' (calculated) vs 'France' (geocoded).

More to the point, I'm not sure what you mean by "International data". The geocoder won't return different results based on which region or locale you're currently in. And if you're concerned about displaying different labels for different locales, you can still do that by just having two string columns. The first column will be interpreted as the string sent to the geocoder, and the second column will be the displayed label.

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/0VHgOVeFf_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages