Skip to content

Commit 6356355

Browse files
authored
Merge pull request #7406 from plotly/cam/7334/switch-geodata-providers-emilykl-2
Updating baselines for new geodata
2 parents da44084 + bb8377b commit 6356355

File tree

62 files changed

+29
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+29
-4
lines changed

src/lib/geo_location_utils.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function locationToFeature(locationmode, location, features) {
6262

6363
for(i = 0; i < filteredFeatures.length; i++) {
6464
f = filteredFeatures[i];
65-
if(f.id === locationId) return f;
65+
if(f.id === locationId && isMainCountryFeature(f)) return f;
6666
}
6767

6868
loggers.log([
@@ -74,6 +74,18 @@ function locationToFeature(locationmode, location, features) {
7474
return false;
7575
}
7676

77+
function isMainCountryFeature(feature) {
78+
// Returns false for certain features which are not the main region of their country
79+
if(feature.id === 'USA') {
80+
if(feature.properties && feature.properties.ct && feature.properties.ct[0] == -155.5 &&
81+
feature.properties.ct[1] == 19.6) {
82+
// Hawaii
83+
return false;
84+
}
85+
}
86+
return true;
87+
}
88+
7789
function feature2polygons(feature) {
7890
var geometry = feature.geometry;
7991
var coords = geometry.coordinates;

src/lib/topojson_utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ topojsonUtils.getTopojsonName = function(geoLayout) {
1313
};
1414

1515
topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) {
16-
return topojsonURL + topojsonName + '.json';
16+
if (topojsonURL.endsWith('/')) {
17+
return topojsonURL + topojsonName + '.json';
18+
} else {
19+
return topojsonURL + '/' + topojsonName + '.json';
20+
}
1721
};
1822

1923
topojsonUtils.getTopojsonFeatures = function(trace, topojson) {
120 KB
-1.82 KB
4.39 KB
131 Bytes
3.33 KB
10.1 KB
6.04 KB
5.34 KB

0 commit comments

Comments
 (0)