I'm trying to parse and display a geojson representation of the UK postcode districts on a Here Map using the JavaScript API within a VueJs application.
The code is relatively simple - districtGeojson is the JSON document. The following function is called after the map has been initialised and displayed:
processGeojson() {
const reader = new H.data.geojson.Reader(districtGeojson, {
disableLegacyMode: true
});
reader.parse();
const layer = reader.getLayer();
this.shapes = layer;
console.log(layer.isValid(7));
try {
this.map.addLayer(layer);
} catch (err) {
console.log('err adding layer', err);
}
}
As you can see, there's a console.log() in there to do some kind of checking on the layer's validity at the default zoom level and it returns true.
All I see is the map flicker briefly and then the plain map is shown. Is there a way to get some feedback from the API on what is going wrong, it seems to just fail silently - addLayer throws no exception?
If necessary, I can share the JSON document but as it's large (5Mb) I wanted to see if there was anything obviously wrong with this code first.