Last change
on this file since 6371 was
6371,
checked in by dkearney, 8 years ago
|
merging changes from trunk into multichoice branch
|
File size:
1.5 KB
|
Line | |
---|
1 | package require Tk |
---|
2 | package require Rappture |
---|
3 | package require RapptureGUI |
---|
4 | |
---|
5 | Rappture::resources::load |
---|
6 | |
---|
7 | set commondir [file join [file dirname [info script]] .. common] |
---|
8 | source [file join $commondir geovis_settings.tcl] |
---|
9 | |
---|
10 | set width 400 |
---|
11 | set height 300 |
---|
12 | wm geometry . ${width}x${height} |
---|
13 | update |
---|
14 | |
---|
15 | set mapviewer [Rappture::MapViewer .g] |
---|
16 | |
---|
17 | pack .g -expand yes -fill both |
---|
18 | |
---|
19 | # Parameters for base layer |
---|
20 | array set xyzParams { |
---|
21 | url {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg} |
---|
22 | } |
---|
23 | array set osm { |
---|
24 | label "OSM" |
---|
25 | cache false |
---|
26 | } |
---|
27 | |
---|
28 | # Parameters for feature layer |
---|
29 | array set ogrParams { |
---|
30 | url {local://afr_elas.shp} |
---|
31 | } |
---|
32 | array set countries { |
---|
33 | label "Countries" |
---|
34 | opacity 0.7 |
---|
35 | } |
---|
36 | set stylesheet { |
---|
37 | s1 { |
---|
38 | fill: #0000ff; |
---|
39 | stroke: #000000; |
---|
40 | stroke-width: 3; |
---|
41 | altitude-clamping: terrain-drape; |
---|
42 | } |
---|
43 | s2 { |
---|
44 | fill: #ff0000; |
---|
45 | stroke: #000000; |
---|
46 | stroke-width: 3; |
---|
47 | altitude-clamping: terrain-drape; |
---|
48 | } |
---|
49 | } |
---|
50 | array set selector1 { |
---|
51 | id 1 |
---|
52 | style s1 |
---|
53 | query "POP2005 < 5000000" |
---|
54 | } |
---|
55 | array set selector2 { |
---|
56 | id 2 |
---|
57 | style s2 |
---|
58 | query "POP2005 >= 5000000" |
---|
59 | } |
---|
60 | set numSelectors 2 |
---|
61 | for {set i 1} {$i < $numSelectors+1} {incr i} { |
---|
62 | lappend selectors [array get selector$i] |
---|
63 | } |
---|
64 | |
---|
65 | # Create a map object |
---|
66 | set map [Rappture::Map #auto] |
---|
67 | |
---|
68 | # Configure layers |
---|
69 | $map addLayer image \ |
---|
70 | osm [array get osm] \ |
---|
71 | xyz [array get xyzParams] |
---|
72 | |
---|
73 | $map addLayer feature \ |
---|
74 | countries [array get countries] \ |
---|
75 | ogr [array get ogrParams] \ |
---|
76 | $stylesheet "" $selectors |
---|
77 | |
---|
78 | # Add map to viewer |
---|
79 | $mapviewer add $map |
---|
80 | $mapviewer scale $map |
---|
81 | |
---|
Note: See
TracBrowser
for help on using the repository browser.