1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
include geoplot.gfn
open us-states.geojson --quiet --frompkg=geoplot
bundle opts = null
opts.title = "Original"
bundle b = bread($mapfile)
geoplot(b, null, opts)
# Shrink Alaska and place underneath the "lower 48"
matrix shift = {34, -35}
matrix center = {-150.885, 62.5503}
matrix scale = {0.3, 0.35}
geoplot_translate_feature(&b, 48, shift, center, scale)
# Shift Hawaii alongside Alaska
shift = {51, 5}
geoplot_translate_feature(&b, 5, shift)
# apply Vasvalingam transformation to make the file more compact
geoplot_simplify(&b, 0.9)
# save modified geojson file
bwrite(b, "us_modified.json")
opts.title = "Modified"
geoplot(b, null, opts)
|