Skip to content

Commit

Permalink
subtract US-SEC from US-FL
Browse files Browse the repository at this point in the history
...using polygon-clipping.difference(). next commit will undo this and just build US-FL from the non-SEC Florida counties instead.

for electricitymaps#1713
  • Loading branch information
snarfed committed Aug 29, 2019
1 parent f133086 commit d239a74
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions web/generate-geometries.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,18 @@ const sec = topojson.topology({'US-SEC': zones['US-SEC']})
const secMerged = topojson.mergeArcs(sec, [sec.objects['US-SEC']]);
zones['US-SEC'] = topojson.feature(sec, secMerged)

// Subtract US-SEC from Florida (US-FL)
const clipping = require('polygon-clipping');
zones['US-FL'] = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiPolygon",
"coordinates": clipping.difference(zones['US-FL'].geometry.coordinates,
zones['US-SEC'].geometry.coordinates)
}
}

// create zonesMoreDetails by getting zone having moreDetails===true
let zonesMoreDetails = {};
zoneDefinitions.forEach(zone => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/world.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5017,6 +5017,13 @@ pluralize@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"

polygon-clipping@^0.14.2:
version "0.14.2"
resolved "https://registry.yarnpkg.com/polygon-clipping/-/polygon-clipping-0.14.2.tgz#5c1b2f61fcf465172750fcdeaed977b0dd7f83f3"
integrity sha512-X0gxP42HkzxxF+MRA3BPoY9A0N9Y2rho9SGJQrLaKGAco6yLTDj/mHRwo45raD8exLvzDXjNKHKZ6bD7MC8hSA==
dependencies:
splaytree "^3.0.0"

posix-character-classes@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
Expand Down Expand Up @@ -6135,6 +6142,11 @@ spdx-license-ids@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87"

splaytree@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/splaytree/-/splaytree-3.0.0.tgz#959301153652d2d6fac15a38843e8149ece326a1"
integrity sha512-/FXCGITlLdmudFnMGSql9FO4P8Xfq3FgxUqiFlJtoQ7/nXqTqKn79xfhGuN+Yt/1kEFmcRUvv9yVjHAOOmqKWA==

split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
Expand Down

0 comments on commit d239a74

Please sign in to comment.