Hi there,
 
Recently i've been trying to create a map of Scotland using gvisgeomap 
within R, using the googleVis package.
This map is to be broken down into council areas using ISO codes.
I was following an example I found where someone had created a map of 
Argentina broken down into provinces.
The code was as follows:

data_AR <- data.frame( Code = c('AR-A','AR-B','AR-C',
'AR-D','AR-E','AR-F','AR-G','AR-H','AR-J','AR-K','AR-L',
'AR-M', 'AR-N','AR-P','AR-Q','AR-R','AR-S','AR-T','AR-U',
'AR-V','AR-W','AR-X','AR-Y','AR-Z'), Provincia = c('Salta',
'Provincia de Buenos Aires','Capital Federal','San Luis',
'Entre Ríos','La Rioja','Santiago del Estero','Chaco',
'San Juan','Catamarca','La Pampa','Mendoza',
'Misiones','Formosa','Neuquén','Río Negro','Santa Fe',
'Tucumán','Chubut','Tierra del Fuego', 'Corrientes',
'Córdoba','Jujuy','Santa Cruz'), Valor = 1:24)

G_AR <- gvisGeoMap(data_AR, locationvar='Code',
numvar='Valor', options=list(region="AR",
displayMode="regions", resolution="provinces"))

plot(G_AR)

This code generates the Geomap displayed at the bottom of this post.

*Trying myself*

Following the logic in the above code, i tried my hand at  doing the same 
for Scotland. However problems occured instantly as 
Scotland/England/NI/Wales are all part of GB.
Using ISO codes, i attempted to plot a map using the 32 different council 
areas. ( ISO codes found at  http://en.wikipedia.org/wiki/ISO_3166-2:GB )

There are 32 codes for council areas in Scotland, such as GB-HLD for the 
Highlands.

Unfortunately all i got was a blank map of the UK, with boundaries still 
broken up into the individual countries. 
I can plot maps broken down by country using GB-SCT/GB-ENG/GB-NIR/GB-WLS 
to display UK comparisons with my data, however I cannot display the 
differences within the countries themselves. ( Which is something I would 
very much like to do! )

I think this is a problem due to the fact geomap doesn't recognise any of 
the GB countries as a region( i.e. region="gb" is valid, but region="sct" 
is not), thus it cannot split out by anything other than the countries.

*Question*
I was wondering if anyone else has experienced similar problems and knows 
if there is a way to get around it?
Currently the only alternative looks like using D3, but I would prefer to 
keep it within R, as i'm combining my googlevis output with shiny 
currently. ( And also, I'm a total Javascript newbie). 

If anyone can help me out, It would be very VERY much appreciated

Cheers, 
Euan

*Argentina example*

<https://lh3.googleusercontent.com/-F9oHU-BUF7c/U6wzqOQ-zlI/AAAAAAAAAAo/ti9RsRuf9FI/s1600/Argentina.png>

 

 

 

 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to