-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Composition Borders * Lint and Tweaks * lint
- Loading branch information
Showing
11 changed files
with
360 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// eslint-disable-next-line import/no-unresolved | ||
const mercatorTw = require('./mercatorTw.cjs.js'); | ||
|
||
// Initialize Projection | ||
let merc = mercatorTw(); | ||
|
||
// Read center from first argument or from defaultCenter | ||
const translate = process.argv[2] && JSON.parse(process.argv[2]); | ||
if (translate) merc = merc.translate(translate); | ||
|
||
// Read scale from second argument or from defaultScale | ||
const scale = process.argv[3] && parseInt(process.argv[3], 10); | ||
if (scale) merc = merc.scale(scale); | ||
|
||
// The properties that we will add to the box | ||
const properties = { | ||
lienchiang: { | ||
BORDERLEVEL: 'COUNTY', NAME: '連江縣', ID: 'Z', CODE: '09007', ENG: 'Lienchiang County', | ||
}, | ||
penghu: { | ||
BORDERLEVEL: 'COUNTY', NAME: '澎湖縣', ID: 'X', CODE: '10016', ENG: 'Penghu County', | ||
}, | ||
kinmen: { | ||
BORDERLEVEL: 'COUNTY', NAME: '金門縣', ID: 'W', CODE: '09020', ENG: 'Kinmen County', | ||
}, | ||
wuqiu: { | ||
BORDERLEVEL: 'TOWN', NAME: '烏坵鄉', ID: 'W06', CODE: '09020060', ENG: 'Wuqiu Township', | ||
}, | ||
}; | ||
|
||
// Generate the features | ||
const features = merc.compositionBorderPoints() | ||
.map((border) => ({ | ||
type: 'Feature', | ||
geometry: { type: 'Polygon', coordinates: [border.coords] }, | ||
properties: properties[border.name], | ||
})); | ||
|
||
// Print to stdout | ||
features.forEach((feature) => { | ||
process.stdout.write(JSON.stringify(feature)); | ||
process.stdout.write('\n'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
#!/bin/bash | ||
|
||
topo2geo villages=- < villages-mercator-10t.json | geo2svg -o img/villages.svg -w 450 -h 600 | ||
svgexport img/villages.svg img/villages.png 2x "path {stroke-width: 0.2px;}" | ||
# Create the border json | ||
topo2geo compBorders=- < nation-mercator-10t.json > img/base-border.json | ||
|
||
topo2geo towns=- < towns-mercator-10t.json | geo2svg -o img/towns.svg -w 450 -h 600 | ||
# Villages | ||
topo2geo villages=- < villages-mercator-10t.json > img/base-villages.json | ||
geojson-merge img/base-villages.json img/base-border.json | geo2svg -o img/villages.svg -w 450 -h 600 | ||
svgexport img/villages.svg img/villages.png 2x "path {stroke-width: 0.3px;}" | ||
|
||
# Towns | ||
topo2geo towns=- < towns-mercator-10t.json > img/base-towns.json | ||
geojson-merge img/base-towns.json img/base-border.json | geo2svg -o img/towns.svg -w 450 -h 600 | ||
svgexport img/towns.svg img/towns.png 2x "path {stroke-width: 0.5px;}" | ||
|
||
topo2geo counties=- < counties-mercator-10t.json | geo2svg -o img/counties.svg -w 450 -h 600 | ||
# Counties | ||
topo2geo counties=- < counties-mercator-10t.json > img/base-counties.json | ||
geojson-merge img/base-counties.json img/base-border.json | geo2svg -o img/counties.svg -w 450 -h 600 | ||
svgexport img/counties.svg img/counties.png 2x | ||
|
||
topo2geo nation=- < nation-mercator-10t.json | geo2svg -o img/nation.svg -w 450 -h 600 | ||
# Nation | ||
topo2geo nation=- < nation-mercator-10t.json > img/base-nation.json | ||
geojson-merge img/base-nation.json img/base-border.json | geo2svg -o img/nation.svg -w 450 -h 600 | ||
svgexport img/nation.svg img/nation.png 2x |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.