File: edit_example.inp

package info (click to toggle)
gretl 2022c-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,552 kB
  • sloc: ansic: 409,074; sh: 4,449; makefile: 3,222; cpp: 2,777; xml: 599; perl: 364
file content (25 lines) | stat: -rw-r--r-- 648 bytes parent folder | download | duplicates (4)
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)