Output Example https://i.sstatic.net/BGQ3V.png
The output I'm seeing is just a simple rectangle, unlike the maps I create using tools like geojson.io or mapshapper. Strangely, there are no errors showing up in my browser console.
My Geojson Data
I have already included an "id" field within the features object. Here's a snippet of my geoJson data:
{type: "FeatureCollection", features: Array(14)}
features: Array(14)
0:
geometry: {type: "Polygon", coordinates: Array(1)}
properties:{
id: 332112
kabupaten: "DEMAK"
kecamatan: "Bonang"
provinsi: "JAWA TENGAH"
__proto__: Object
type: "Feature"
__proto__: Object
}
1: {type: "Feature", geometry: {…}, properties: {…}}
2: {type: "Feature", geometry: {…}, properties: {…}}
AmChart Implementation
This is the Vue.js code I'm using to load the amcharts map:
import * as am4core from "@amcharts/amcharts4/core"
import * as am4maps from "@amcharts/amcharts4/maps"
import robots from "./assets/demak"
export default {
mounted() {
let map = am4core.create("chartdiv", am4maps.MapChart)
map.geodata = robots
console.log(robots);
map.projection = new am4maps.projections.Miller()
var polygonSeries = map.series.push(new am4maps.MapPolygonSeries())
polygonSeries.useGeodata = true
var polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.fill = am4core.color("#74B266");
polygonTemplate.tooltipText = "{KABUPATEN}";
var hs = polygonTemplate.states.create("hover");
hs.properties.fill = am4core.color("#367B25");
// Add zoom control
map.zoomControl = new am4maps.ZoomControl();
},
beforeDestroy() {
if (this.map) {
this.map.dispose()
}
}
}