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

lineclip.sh 1.2 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
  1. #!/usr/bin/env bash
  2. # Example of problem submitted by Roger Davis, HMRG, Issue #603
  3. # Point 0 is slightly inside, all others are outside. Got diagonal
  4. # line from TR corner to point 3
  5. ps=lineclip.ps
  6. cat <<END > t.txt
  7. -131.69539 9.882795
  8. -131.60807 9.88348
  9. -131.60749 9.80983
  10. -131.69480 9.80915
  11. END
  12. gmt mapproject -R-131.74249/9.8087739/-131.65578/9.883111r -Ju9/1:90000 t.txt -Di > t.xy
  13. gmt psxy -R-1/10/-1/10 -Jx1i t.xy -W0.25p,- -K -P -X0 -Y0 > $ps
  14. gmt psxy -A -R-131.74249/9.8087739/-131.65578/9.883111r -Ju9/1:90000 -L t.txt -W3p -O -K -X1i -Y1i >> $ps
  15. gmt psxy -R -J -O -K -N -Sc0.25i -Gyellow -W0.25p t.txt -Baf >> $ps
  16. awk '{print $1, $2, NR-1}' t.txt | gmt pstext -R -J -O -K -N -F+f12p+jCM >> $ps
  17. # Change first y coordinate from 9.882795 to 9.882794
  18. cat <<END > t.txt
  19. -131.69539 9.882794
  20. -131.60807 9.88348
  21. -131.60749 9.80983
  22. -131.69480 9.80915
  23. END
  24. gmt mapproject -R-131.74249/9.8087739/-131.65578/9.883111r -Ju9/1:90000 t.txt -Di > t.xy
  25. gmt psxy -R-1/10/-1/10 -Jx1i t.xy -W0.25p,- -K -O -Y4i -X-1i >> $ps
  26. gmt psxy -A -R-131.74249/9.8087739/-131.65578/9.883111r -Ju9/1:90000 -L t.txt -W3p -O -K -X1i -Y1i >> $ps
  27. gmt psxy -R -J -O -K -N -Sc0.25i -Gyellow -W0.25p t.txt -Baf >> $ps
  28. awk '{print $1, $2, NR-1}' t.txt | gmt pstext -R -J -O -N -F+f12p+jCM >> $ps
Tip!

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

Comments

Loading...