Skip to content

Use sane-topojson v3 #3874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 17, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use 'gu' (aka governing unit set in topojson)
... to improve fix for #3779
  • Loading branch information
etpinard committed May 16, 2019
commit 58b92f8f3023d939e4bb6c557a6fee2cb14c07d6
9 changes: 2 additions & 7 deletions src/lib/geo_location_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ function locationToFeature(locationmode, location, features) {

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