File: test_map.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (153 lines) | stat: -rw-r--r-- 6,169 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
;
; A visual way to check some projections and Earth cartography.
;
; --------------------------------------------
; This code is under GNU GPL v2 or later.
;
; Creation by AC, 27-Feb-2007. updated 17-avr-2007
; 25-May2007 : 2 messages were removed since all the cases are now
; working for x86 and x86_64
;
; History
; AC 28-Jul-2008: 2 new projections provided by Joel.
;
; Spring 2014: large rewritting by Gilles D., adding a lot
; of examples linked to newly available projections in GDL
;
; 2014 July 30: some help to run this test !
;
; Purpose: A very simple test for MAP library
; (a way not to forgot how to call the mapping procedures !!)
;
; AC 2019-02-12 : few revisions,  better search for MAP_INSTALL
;
; GD 2019-03-10 : replaced all gshh* code with shapelib and 
;                 naturalearthdata.com shapefiles so removed any
;                 gshhsg related procedures and code. Added however
;                 new procedures to build a shapefile from the gshhsg data,
;                 in case it helps.
; GD 2019-12-20 : removed all searches for 'foreign' procedures as we
; have everything now within GDL.
; --------------------------------------------
;
function INTERNAL_GDL_MAP_LIBS
;
FORWARD_FUNCTION PROJ_EXISTS
;
status=0
;
;
if PROJ_EXISTS() then return, 10

print, 'Unfortunalty, GDL was compiled without PROJ support !'
return,0

end
;
;
; ------------------------------------
;
pro INTERNAL_GDL_MAP_CHECK, test=test
;
ON_ERROR, 2
;
; Checking if GDL is compiled with one of the 2 projections libraries
;
status=INTERNAL_GDL_MAP_LIBS()
;
if (status Lt 10)  then begin
   MESSAGE, /continue, 'GDL without Projection support !'
   MESSAGE, 'please read the MAP_INSTALL document in the root of the GDL dir.'
   exit
endif
end
;
; ------------------------------------
;
function DoWeBreak, tictac=tictac
;
; when tictac set, we just wait a given time then continue
; (no interative question, no break)
;
if KEYWORD_SET(tictac) then begin
   WAIT, tictac
   return, 0
endif
;
msg='Press Q to quit, any key or Enter to continue '
;
key=''
read, prompt=msg, key
;
if (STRUPCASE(key) EQ 'Q') then return, 1 else return, 0
;
end
;
; ------------------------------------
;
pro TEST_MAP, tictac=tictac, test=test
;
INTERNAL_GDL_MAP_CHECK
;
print, 'Exemple 1: Should plot the whole "classical view" of the world with a grid'
map_set,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 2: Should plot Europa using Gnomic Projection, scale 30,000,000'
map_set,50,15,/gnom,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15},scale=3E7
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 2 bis: same with rivers and country boundaries'
map_set,50,15,/gnom,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}, scale=3E7
MAP_CONTINENTS, color='AAAA00'x, /river
MAP_CONTINENTS, color='000000'x, /countrie
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 4: Should plot North America using Gnomic Projection'
map_set,40,-105,/gnom,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}, scale=3E7
MAP_CONTINENTS, /USA, color='000000'x

if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 5: Should plot North America using Satellite Projection'
MAP_SET, 40,-105, /satellite, /grid, /cont,limit=[20,-130,70,-70], $
         sat_p=[2.22, 0, 0], title='Satellite Projection, North America'
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 6: Should plot World centered on Crozon peninsula using (GDL ONY) eckert1 projection -- Checking PROJ equivalent command used in the background'
map_set,name="eckert1",48.3,-4.5,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15},/check
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 7: same zooming on Crozon, scale is 1:100000'
map_set,/ortho,48.3,-4.5,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:1,londel:1},scale=1E6
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 8: Should plot World using (GDL ONY) Bertin projection'
map_set,name="Bertin",/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 9: Should plot World using CYLINDRICAL projection'
map_set,/CYL,/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}
if DoWeBreak(tictac=tictac) then goto, go_to_end
;
print, 'Exemple 10: Should plot World using CONICAL projection'
map_set,/CONIC,standard_par=[30,60],/iso,e_cont={cont:1,fill:1,color:'33e469'x,hires:1},/hor,e_hor={nvert:200,fill:1,color:'F06A10'x},e_grid={box_axes:1,color:'1260E2'x,glinethick:1,glinestyle:0,latdel:10,londel:15}
;
if DoWeBreak(tictac=tictac) then goto, go_to_end
!P.MULTI=0
READ_JPEG,FILE_SEARCH(!GDL_MAPS_DIR, 'earth.jpg'),R
map_set,0,48.83,name="GoodesHomolosine",/iso
im=map_image(r,Startx,Starty)
tv,im,startx,starty
map_continents
Z = SHIFT(DIST(40), 20, 20)& Z = EXP(-(Z/10)^2)& xx=findgen(40,40) mod 40 &xx-=20 & yy=transpose(xx)& xx*=3 &yy+=30
contour,z,xx,yy,/over,/fill & contour,z,xx,yy,/over
map_horizon
xyouts,-30,30,"Hurricane",chars=3,charth=3
print, 'last demo done'
;
go_to_end:
;
if KEYWORD_SET(test) then STOP
;
end