Question

I try to plot all provinces of Germany along with some data in googlevis gvisGeoChart.

However, not all provinces are displayed: Thuringia, Baden-Württemberg and Brandenburg are missing. I guess this is connected to the Umlaut included in two of them. But switching to English names or replacing "ü" with "u" does not work.

So my question: Is there a source for all names of provinces.

bundeslander <-
structure(list(state.name = structure(1:16, .Label = c("Baden-Württemberg", 
"Bayern", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", 
"Mecklenburg-Vorpommern", "Niedersachsen", "Nordrhein-Westfalen", 
"Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", 
"Thüringen"), class = "factor"), abbrev = structure(c(3L, 4L, 
2L, 1L, 5L, 7L, 6L, 8L, 9L, 10L, 11L, 13L, 14L, 15L, 12L, 16L
), .Label = c("(BB)", "(BE)", "(BW)", "(BY)", "(HB)", "(HE)", 
"(HH)", "(MV)", "(NI)", "(NW)", "(RP)", "(SH)", "(SL)", "(SN)", 
"(ST)", "(TH)"), class = "factor"), Share = c(12.1, 
9.9, 14.1, 2.8, 12.7, 13.8, 11.5, 2.5, 6.9, 10.7, 7.9, 8.7, 2.9, 
1.9, 5.3, 2.3)), .Names = c("state.name", "abbrev", "Share"
), class = "data.frame", row.names = c(NA, -16L))

G3 <- gvisGeoChart(bundeslander, "state.name", "Share",
options=list(region="DE", displayMode="regions", resolution="provinces",
width=600, height=400))
plot(G3)
Was it helpful?

Solution

your code is correct (even though I can't quite identify what language you're using or how exactly it ties to the GeoChart). What's happening here is that our geocoding cache is out of sync and needs to be refreshed. We're currently in the middle of rebuilding our Geo data generation, so this should happen soon, but I don't have an estimate for exactly when just yet.

Meanwhile, you can just use your abbreviations as ISO codes, and render the provinces that way. Here is a jsfiddle that does that: http://jsfiddle.net/Uwpjg/

function drawVisualization() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Code', 'Location', 'Value'],
    ['DE-BW', 'Baden-Württemberg', 10],
    ['DE-BY', 'Bayern', 10],
    ['DE-BE', 'Berlin', 10],
    ['DE-BB', 'Brandenburg', 10],
    ['DE-HB', 'Bremen', 10],
    ['DE-HH', 'Hamburg', 10],
    ['DE-HE', 'Hessen', 10],
    ['DE-MV', 'Mecklenburg-Vorpommern', 10],
    ['DE-NI', 'Niedersachsen', 10],
    ['DE-NW', 'Nordrhein-Westfalen', 10],
    ['DE-RP', 'Rheinland-Pfalz', 10],
    ['DE-SL', 'Saarland', 10],
    ['DE-SN', 'Sachsen', 10],
    ['DE-ST', 'Sachsen-Anhalt', 10],
    ['DE-SH', 'Schleswig-Holstein', 10],
    ['DE-TH', 'Thüringen', 10],
  ]);

  // Create and draw the visualization.
  new google.visualization.GeoChart(document.getElementById('visualization')).
  draw(data, {
      width:600,
      height:400,
      region: 'DE',
      resolution: 'provinces'
  });
}

OTHER TIPS

I think the names and abbreviations you use for the states are correct (see this wiki-page)

Using your code I am able to plot all the data except for Brandenburg for some unknown reason.

When I change the names for Thüringen and Baden-Württemberg, leaving out the umlauts, your problem is replicated leaving out their data in the plot.

The weird thing is that when I change display mode from "region" to "marker" all the data is shown, including Brandenburg.

I haven't been able to find out what the exact problem is. Maybe the folks at gis.stackexchange have some more insight into this issue?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top