Search code examples
google-visualizationgwt-visualization

GeoMap for austria with lower austria and vienna


When I use gwt-visualization and GeoMap it happens that when I give a value to Vienna it works fine, but if I give a value to lower austria -> Vienna is not shown anymore on the map.

geomap picture

Heres the code I use to create the geomap:

private Options createOptions() {
        Options options = Options.create();
        options.setDataMode(DataMode.REGIONS);
        options.setWidth(1000);
        options.setHeight(650);
        options.setRegion("AT");
        return options;
    }

    private AbstractDataTable createTable2() {
        DataTable data = DataTable.create();
        data.addColumn(ColumnType.STRING, "Bundesland");
        data.addColumn(ColumnType.NUMBER, "Sessions");

        data.addRows(9);

        data.setValue(0, 0, "Niederösterreich");
        data.setValue(0, 1, 200);

        data.setValue(1, 0, "Salzburg");
        data.setValue(1, 1,56);

        data.setValue(2, 0, "Tirol");
        data.setValue(2, 1, 11);

        data.setValue(3, 0, "Oberösterreich");
        data.setValue(3, 1, 11);


        data.setValue(4, 0, "Burgenland");
        data.setValue(4, 1, 55);


        data.setValue(5, 0, "Vorarlberg");
        data.setValue(5, 1, 567);

        data.setValue(6, 0, "Kärnten");
        data.setValue(6, 1, 11);

        data.setValue(7, 0, "Steiermark");
        data.setValue(7, 1, 99);

        data.setValue(8, 0, "Wien");
        data.setValue(8, 1, 1);

        return data;
    }

I think the reason why this is happen is becaus lower austria surround vienna. Is there a way to get this working?


Solution

  • It looks like GeoMaps does not include AT-9 in its map. In your luck, GeoCharts (the non-flash newer version of GeoMaps) does.

    I don't use GWT, so I won't be able to tell you how to translate this in to GWT (apologies, maybe someone else can tack on the proper syntax). Here is the code:

    function drawVisualization() {
      var data = google.visualization.arrayToDataTable([
        ['Bundesland', 'Sessions'],
        ['AT-3', 200],
        ['AT-5', 56],
        ['AT-7', 11],
        ['AT-4', 11],
        ['AT-1', 55],
        ['AT-8', 567],
        ['AT-2', 11],
        ['AT-6', 99],
        ['AT-9', 1]
      ]);
    
      var geochart = new google.visualization.GeoChart(
          document.getElementById('visualization'));
      geochart.draw(data, {region: 'AT', resolution: 'provinces', width: 556, height: 347});
    }
    

    In general, I suggest using the ISO-3166 codes for whichever country you map to make it render faster. Let me know if it works!