source: trunk/examples/mapviewer/wms/wms_example.tcl @ 6209

Last change on this file since 6209 was 6209, checked in by dkearney, 8 years ago

adding mapviewer examples from rappture-bat

File size: 1.6 KB
Line 
1package require Rappture
2package require RapptureGUI
3
4Rappture::resources::load
5
6set commondir [file join [file dirname [info script]] .. common]
7source [file join $commondir geovis_settings.tcl]
8
9set width 400
10set height 300
11wm geometry . ${width}x${height}
12update
13
14set mapviewer [Rappture::MapViewer .g]
15
16pack .g -expand yes -fill both
17
18# create a OSGeo WMS layer
19array set dp1 {
20    url {http://vmap0.tiles.osgeo.org/wms/vmap0}
21    layers "basic"
22    format "jpeg"
23    transparent false
24}
25array set l1 {
26    label "OSGeo WMS Layer"
27    description "base layer from OSGeo"
28    opacity 1.0
29}
30
31# create a Population Density 2000 layer
32array set dp4 {
33    url {http://sedac.ciesin.columbia.edu/geoserver/wms}
34    layers "gpw-v3:gpw-v3-population-density_2000"
35    format "png"
36    transparent true
37}
38array set l4 {
39    label "Population Density 2000"
40    description "Columbia Population Density 2000 Data"
41    opacity 0.9
42}
43
44# create a crop climate layer
45array set dp5 {
46    url {http://sedac.ciesin.columbia.edu/geoserver/wms}
47    layers "crop-climate:crop-climate-effects-climate-global-food-production"
48    format "png"
49    transparent true
50}
51array set l5 {
52    label "Crop Climate"
53    description "Columbia Crop Climate Data"
54    opacity 0.5
55}
56
57# create a map object
58set map [Rappture::Map #auto]
59
60# add all layers to the map object
61$map addLayer image \
62    l1 [array get l1] \
63    wms [array get dp1]
64
65$map addLayer image \
66    l4 [array get l4] \
67    wms [array get dp4]
68
69$map addLayer image \
70    l5 [array get l5] \
71    wms [array get dp5]
72
73# add a map to the vis client
74$mapviewer scale $map
75$mapviewer add $map
Note: See TracBrowser for help on using the repository browser.