Google Geomap visualization for Italian provinces (not regions)

I try to use Google Geometap renderings to show Italian regions (Sicily, Tuscany ...) and then provinces in a region (in Sicily, for example, Catania, Palermo ...).

Showing regions is not difficult and works great.

The problem arises when I tried to show the provinces in the area centering the map in the desired area.

Here you can find an example at jsfiddle http://jsfiddle.net/mbutubuntu/uCQRL/1/ .

I noticed in the GeoChart documentation (link: https://developers.google.com/chart/interactive/docs/gallery/geochart#Configuration_Options ) that the 'resolution' property can be ['countries', 'provinces', 'metros' ].

The document also says:

"provinces" - is supported only for regions of the country and state regions of the United States. Not supported for all countries; Please check your country to find out if this option is supported.

Is it possible that GeoMap does not support the "provinces" for Italy? If so, how can I fix this problem?

Best regards, F. Buda

+4
source share
2 answers

Perhaps now there is a new version of Google Chart.

At this point, GeoChart supports resolution:"provinces" for Italy, but they actually correspond to the regions (Sicily, Sardinia, Piedmont, etc.).

The Google Chart seems to support only one level of division within the country, calling it equally a "province."

In addition, it is not possible to set the province as the param region chart.

+2
source

you can use this code https://github.com/rarylson/geochart-geojson with this geojson https://github.com/Dataninja/geo-shapes/blob/master/italy/provinces.geojson

  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=<YOURKEY>" </script> <script type="text/javascript" src="https://cdn.rawgit.com/rarylson/geochart-geojson/master/build/geochart-geojson.min.js"></script> <script type="text/javascript"> google.charts.load("current"); google.charts.setOnLoadCallback(drawVisualization); function drawVisualization() { // Create and populate a data table var data = new google.visualization.DataTable(); data.addColumn("string", "City"); data.addColumn("number", "Value"); data.addRows([ ["VERCELLI", 10], ["NOVARA", 5], ]); // Instantiate our Geochart GeoJSON object var vis = new geochart_geojson.GeoChart(document.getElementById("mydiv")); // Set Geochart GeoJSON options var options = { mapsOptions: { center: {lat: 42, lng: 12}, zoom:6 }, geoJson: "https://raw.githubusercontent.com/Dataninja/geo-shapes/master/italy/provinces.geojson", geoJsonOptions: { idPropertyName: "NOME_PRO" } }; // Draw our Geochart GeoJSON with the data we created locally vis.draw(data, options); } </script> </head> <body> <div id="mydiv" style="width: 900px; height: 560px;"></div> </body> 
-1
source

All Articles