Skip to content

Commit 58b92f8

Browse files
committed
use 'gu' (aka governing unit set in topojson)
... to improve fix for #3779
1 parent 928ba03 commit 58b92f8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/lib/geo_location_utils.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,16 @@ function locationToFeature(locationmode, location, features) {
4242

4343
if(locationId) {
4444
if(locationmode === 'USA-states') {
45-
// Filter out features south of the equator
45+
// Filter out features out in USA
4646
//
4747
// This is important as the Natural Earth files
4848
// include state/provinces from USA, Canada, Australia and Brazil
4949
// which have some overlay in their two-letter ids. For example,
5050
// 'WA' is used for both Washington state and Western Australia.
51-
// As subunits from USA and Canada never conflict, filtering out features
52-
// south of the equator suffices to fix https://github.com/plotly/plotly.js/issues/3779
53-
//
54-
// A better fix would have us add a "governing unit" properties in subunit features
55-
// in the `sane-topojson` package to avoid conflicts.
5651
features2 = [];
5752
for(i = 0; i < features.length; i++) {
5853
f = features[i];
59-
if(f.properties && f.properties.ct && f.properties.ct[1] > 0) {
54+
if(f.properties && f.properties.gu && f.properties.gu === 'USA') {
6055
features2.push(f);
6156
}
6257
}

0 commit comments

Comments
 (0)