source: branches/multichoice/examples/mapviewer/feature/feature_selector_query.tcl @ 6371

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 
1package require Tk
2package require Rappture
3package require RapptureGUI
4
5Rappture::resources::load
6
7set commondir [file join [file dirname [info script]] .. common]
8source [file join $commondir geovis_settings.tcl]
9
10set width 400
11set height 300
12wm geometry . ${width}x${height}
13update
14
15set mapviewer [Rappture::MapViewer .g]
16
17pack .g -expand yes -fill both
18
19# Parameters for base layer
20array set xyzParams {
21    url {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg}
22}
23array set osm {
24    label "OSM"
25    cache false
26}
27
28# Parameters for feature layer
29array set ogrParams {
30    url {local://afr_elas.shp}
31}
32array set countries {
33    label   "Countries"
34    opacity 0.7
35}
36set 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}
50array set selector1 {
51    id    1
52    style s1
53    query "POP2005 < 5000000"
54}
55array set selector2 {
56    id    2
57    style s2
58    query "POP2005 >= 5000000"
59}
60set numSelectors 2
61for {set i 1} {$i < $numSelectors+1} {incr i} {
62   lappend selectors [array get selector$i]
63}
64
65# Create a map object
66set 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.