1 | package require Rappture |
---|
2 | package require RapptureGUI |
---|
3 | |
---|
4 | Rappture::resources::load |
---|
5 | |
---|
6 | set commondir [file join [file dirname [info script]] .. common] |
---|
7 | source [file join $commondir geovis_settings.tcl] |
---|
8 | |
---|
9 | set width 400 |
---|
10 | set height 300 |
---|
11 | wm geometry . ${width}x${height} |
---|
12 | update |
---|
13 | |
---|
14 | set mapviewer [Rappture::MapViewer .g] |
---|
15 | |
---|
16 | pack .g -expand yes -fill both |
---|
17 | |
---|
18 | # create xyz layer |
---|
19 | array set xyzParams { |
---|
20 | url {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg} |
---|
21 | } |
---|
22 | array set osm { |
---|
23 | label "OSM" |
---|
24 | cache false |
---|
25 | } |
---|
26 | |
---|
27 | # create a colorramp layer |
---|
28 | set colormap { |
---|
29 | 0.00 0 0 1 1 |
---|
30 | 0.25 0 1 1 1 |
---|
31 | 0.50 0 1 0 1 |
---|
32 | 0.75 1 1 0 1 |
---|
33 | 1.00 1 0 0 1 |
---|
34 | } |
---|
35 | array set colorrampParams [subst { |
---|
36 | url {file:///usr/share/geovis/landuse/scplot_with_coordinate_system.tif} |
---|
37 | colormap {$colormap} |
---|
38 | }] |
---|
39 | array set landuse { |
---|
40 | label "Color Ramp" |
---|
41 | coverage true |
---|
42 | } |
---|
43 | |
---|
44 | # create an OGR Line layer |
---|
45 | array set ogrParams { |
---|
46 | url {local://afr_countries.shp} |
---|
47 | } |
---|
48 | array set countries { |
---|
49 | label "Country boundaries" |
---|
50 | style "-color black -width 2.0" |
---|
51 | } |
---|
52 | |
---|
53 | # create a map object |
---|
54 | set map [Rappture::Map #auto] |
---|
55 | $mapviewer scale $map |
---|
56 | |
---|
57 | # ------------------------------------------------- |
---|
58 | # launch the mapviewer |
---|
59 | # show individual layers of the map at 10 second intervals |
---|
60 | |
---|
61 | after 10000 { |
---|
62 | # add a layer to the map object |
---|
63 | $map addLayer image \ |
---|
64 | osm [array get osm] \ |
---|
65 | xyz [array get xyzParams] |
---|
66 | |
---|
67 | $mapviewer add $map |
---|
68 | puts stderr "Added OSM Layer" |
---|
69 | } |
---|
70 | |
---|
71 | after 15000 { |
---|
72 | # remove the OSM layer from the map |
---|
73 | $map deleteLayer osm |
---|
74 | |
---|
75 | # add the colorramp layer to the map |
---|
76 | $map addLayer image \ |
---|
77 | landuse [array get landuse] \ |
---|
78 | colorramp [array get colorrampParams] |
---|
79 | |
---|
80 | # Update map |
---|
81 | $mapviewer delete |
---|
82 | $mapviewer add $map |
---|
83 | puts stderr "Deleted OSM Layer, Added colorramp" |
---|
84 | } |
---|
85 | |
---|
86 | after 20000 { |
---|
87 | # remove the colorramp layer from the map |
---|
88 | $map deleteLayer landuse |
---|
89 | |
---|
90 | # add the line feature layer to the map |
---|
91 | $map addLayer line \ |
---|
92 | countries [array get countries] \ |
---|
93 | ogr [array get ogrParams] |
---|
94 | |
---|
95 | # Update map |
---|
96 | $mapviewer delete |
---|
97 | $mapviewer add $map |
---|
98 | puts stderr "Deleted colorramp Layer, Added line layer" |
---|
99 | } |
---|
100 | |
---|
101 | # build up the map layer by layer at 5 second intervals |
---|
102 | |
---|
103 | after 25000 { |
---|
104 | $map deleteLayer countries |
---|
105 | |
---|
106 | # add the OSM layers to the map |
---|
107 | $map addLayer image \ |
---|
108 | osm [array get osm] \ |
---|
109 | xyz [array get xyzParams] |
---|
110 | |
---|
111 | # Update map |
---|
112 | $mapviewer delete |
---|
113 | $mapviewer add $map |
---|
114 | puts stderr "Deleted line Layer, Added OSM layer" |
---|
115 | } |
---|
116 | |
---|
117 | after 30000 { |
---|
118 | # add the colorramp layer to the map |
---|
119 | $map addLayer image \ |
---|
120 | landuse [array get landuse] \ |
---|
121 | colorramp [array get colorrampParams] |
---|
122 | |
---|
123 | # Update map |
---|
124 | $mapviewer delete |
---|
125 | $mapviewer add $map |
---|
126 | puts stderr "Added colorramp layer" |
---|
127 | } |
---|
128 | |
---|
129 | after 35000 { |
---|
130 | # add the line feature layer to the map |
---|
131 | $map addLayer line \ |
---|
132 | countries [array get countries] \ |
---|
133 | ogr [array get ogrParams] |
---|
134 | |
---|
135 | # Update map |
---|
136 | $mapviewer delete |
---|
137 | $mapviewer add $map |
---|
138 | puts stderr "Added line layer" |
---|
139 | } |
---|
140 | |
---|