Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

lookup.sh 1.6 KB

You have to be logged in to leave a comment. Sign In
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  1. #!/usr/bin/env bash
  2. # Test that @D records after a new segment header are properly
  3. # processed so metadata is used to set color, etc. Based on
  4. # example in issue # 539. Original plot faked with direct psxy plot.
  5. #
  6. # Update 5/6/2016 PW: Fixed this by improving the text parsing:
  7. # When we find a segment header in a OGR file we read the next
  8. # line, parse it, and then build a segment header with any non-
  9. # column items like -G, -Z, etc. Thus in this case, the colors
  10. # are written as "> -G<r/g/b" segment headers and thus psxy can
  11. # parse that to get the polygon colors.
  12. ps=lookup.ps
  13. cat << EOF > ogr.txt
  14. # @VGMT1.0 @GPOLYGON
  15. # @R-180.000002508/185.593483405/-53.6649710199/82.1554661247
  16. # @Jp"+proj=longlat +datum=WGS84 +no_defs "
  17. # @Jw"GEOGCS[\"wgs84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]"
  18. # @Ncat|minor_group|major_group|name|grassrgb|gmtrgb|major_group_name
  19. # @Tinteger|integer|integer|string|string|string|string
  20. # FEATURE_DATA
  21. >
  22. # @D5|43|5|Egypt|110:186:103|110/186/103|"Urbanized societies / kingdoms"
  23. # @P
  24. 22.3 32
  25. 24.2 32.3
  26. 26.0 34.7
  27. 24.4 34.6
  28. 22.3 32
  29. >
  30. # @D6|41|4|Norway|173:216:230|lightblue|"Urbanized societies / kingdoms"
  31. # @P
  32. 24.3 35
  33. 26.2 36.3
  34. 27.8 37.7
  35. 26.4 37.6
  36. 24.3 35
  37. EOF
  38. gmt psxy ogr.txt -R22/28/31/38 -JM6i -W1p -Baf -A -aG=gmtrgb -P > $ps
  39. #
  40. # For test to fail, orig was made with
  41. #cat << EOF > ogr.txt
  42. #> -G110/186/103
  43. #22.3 32
  44. #24.2 32.3
  45. #26.0 34.7
  46. #24.4 34.6
  47. #22.3 32
  48. #> -Glightblue
  49. #24.3 35
  50. #26.2 36.3
  51. #27.8 37.7
  52. #26.4 37.6
  53. #24.3 35
  54. #EOF
  55. #gmt psxy ogr.txt -R22/28/31/38 -JM6i -W1p -Baf -A -Gred -P > $ps
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...