Debian Codegraph @

addons/geoplot/examples/edit_example.inp

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