highcharts / map-collection-dist

Other
30 stars 37 forks source link

Map Collection does not have world map with disputed areas #4

Open jon-a-nygaard opened 5 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#5061 for full details.

KacperMadej commented 5 years ago

Here's a low resolution world map demo: http://jsfiddle.net/BlackLabel/escywjo7/

(Compare with the default: http://jsfiddle.net/gh/get/library/pure/highslide-software/highcharts.com/tree/master/samples/mapdata/custom/world-lowres)

@jon-a-nygaard fyi

KacperMadej commented 5 years ago

Medium resolution: http://jsfiddle.net/BlackLabel/mg6Loz8a/

(Default: http://jsfiddle.net/gh/get/library/pure/highslide-software/highcharts.com/tree/master/samples/mapdata/custom/world)

I also have other versions (.geo.json and different details levels maps), but those files are big enough to make a JSFiddle demo almost not responsive (works fine when loaded as a file - as the map should be loaded). If you need any other file please let me know and I'll share it.

Those maps are based on edited sources and are not perfect (shapes of India border), so for a proper fix will probably need a better source.

kamilkulig commented 5 years ago

Data labels are not positioned properly in the above demos: image

Workaround:

Import the default map (<script src="https://code.highcharts.com/mapdata/custom/world.js"></script>) and change the name of the custom map: image

Then use the following code to restore original data labels positioning:

Highcharts.maps['custom/world-disputed'].features.forEach(function(featureDisputed) {
    var feature = Highcharts.maps['custom/world'].features.find(function(feature) {
    return feature.properties.name === featureDisputed.properties.name;
  });
  if(feature) {
    featureDisputed.properties["hc-middle-x"] = feature.properties["hc-middle-x"];
    featureDisputed.properties["hc-middle-y"] = feature.properties["hc-middle-y"];
  }
});

Live demo: http://jsfiddle.net/BlackLabel/g1znwd8b/

ghost commented 4 years ago

I thought this was going to cover the dispute between China and India, so if you do make this change, please incorporate that as well. Here's an outline, look next to Bhutan. http://4.bp.blogspot.com/-C2YTToI22ME/UCp7e-AQvfI/AAAAAAAABs0/ZO2zw7O1Mb4/s1600/China-Landkarte.gif

s-prateek commented 3 years ago

Data labels are not positioned properly in the above demos: image

Workaround:

Import the default map (<script src="https://code.highcharts.com/mapdata/custom/world.js"></script>) and change the name of the custom map: image

Then use the following code to restore original data labels positioning:

Highcharts.maps['custom/world-disputed'].features.forEach(function(featureDisputed) {
  var feature = Highcharts.maps['custom/world'].features.find(function(feature) {
      return feature.properties.name === featureDisputed.properties.name;
  });
  if(feature) {
      featureDisputed.properties["hc-middle-x"] = feature.properties["hc-middle-x"];
      featureDisputed.properties["hc-middle-y"] = feature.properties["hc-middle-y"];
  }
});

Live demo: http://jsfiddle.net/BlackLabel/g1znwd8b/

@KacperMadej @kamilkulig As this is a custom map, is it allowed to be used in a commercial application with Highcharts license? I'm asking this because I don't see this or any other custom map in the map collection and this particular issue is still in open state.

KacperMadej commented 3 years ago

I apologize for the long reply time.

In short: yes.

In full: For your convenience, Highcharts Maps offers a free collection of maps, optimized for use with Highcharts Maps. This also applies to edited maps available as workarounds.

Copyright information for each map can be found as properties in the GeoJSON and Javascript files. This applies to edited maps available as workarounds.

In general, and doesn't apply in this case, if a source of a new map (or a custom map, or an edited custom map provided as a workaround) adds license-related requirements then such information is provided with the map file or demo.