highcharts / map-collection-dist

Other
30 stars 37 forks source link

Norway, counties Sør-Trøndelag and Nord-Trøndelag were merged #24

Closed jon-a-nygaard closed 4 years ago

jon-a-nygaard commented 5 years ago

This issue is a continuation of an issue reported in the highcharts/highcharts repository, please see highcharts/highcharts#8199 for full details.

RonjaKnudtsen commented 5 years ago

Is this solved?

RonjaKnudtsen commented 5 years ago

FYI Norway will be merged into a total of 11 counties by the end of 2020 https://no.wikipedia.org/wiki/Regionreformen_i_Norge

I have a custom hack in angular. However im having issues when I update the map after it has been initialized. It gets some weird render issues.

If someone is interested here is the code

public updateMap(mapNorway) {

    // Create feature/trøndelag object.
    const trondelag = {
      type: 'Feature',
      id: 'NO.TL',
      properties: {},
      geometry: {
        coordinates: [],
        type: 'MultiPolygon'
      },
    };

    // Get the cordinates for nord and sør
    const nordTrondelag = mapNorway.features.find(a => a.id === 'NO.NT');
    const sorTrondelag = mapNorway.features.find(a => a.id === 'NO.ST');
    // merge them into trondelag geometries.
    trondelag.geometry.coordinates = [...nordTrondelag.geometry.coordinates, ...sorTrondelag.geometry.coordinates];

    // Create Trøndelag properties.
    trondelag.properties = {
      'alt-name': 'Nord-Troendelag fylke|Nordre Trondhjem|Norður-Þrændalög',
      'country': 'Norway',
      'fips': 'NO10',
      'hasc': 'NO.TL',
      'hc-a2': 'TL',
      'hc-group': 'admin1',
      'hc-key': 'no-tl',
      'hc-middle-x': 0.55,
      'hc-middle-y': 0.55,
      'labelrank': '7',
      'latitude': '63.522759',
      'longitude': '10.474425',
      'name': 'Trøndelag',
      'postal-code': 'TL',
      'region': null,
      'subregion': null,
      'type': 'Fylke',
      'type-en': 'County',
      'woe-id': '23424910',
      'woe-label': 'Trondelag, NO, Norway',
      'woe-name': 'Trøndelag'
    };
    // Create a updated map object
    const updatedMap = {...mapNorway};
    // Filter out sør and nord trøndelag
    updatedMap.features = updatedMap.features.filter(a => a.id !== 'NO.NT' && a.id !== 'NO.ST');
    // append the new fylke.
    updatedMap.features = [...updatedMap.features, trondelag];
    return updatedMap
  }
jon-a-nygaard commented 5 years ago

Hi @RonjaKnudtsen, thanks for posting the workaround.

This issue is unfortunately not solved. We are planning a new release to solve this and similar layout issues. It is however currently uncertain when we will be able to release this update due to technical challenges.

We will make sure to update the issue as soon as we can provide an ETA.

KacperMadej commented 4 years ago

The new map of Norway for 2020 will be a part of the next version of the map collection. The 2 counties merge reported in this issue will be included, but we will be missing the map with only that merge. If you need that (only the 2 counties merged and no 2020-changes) map please vote up this comment (even if the issue will be closed).