source: branches/geomap/examples/mapviewer/wms/wms_example.tcl @ 5951

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

adding mapviewer examples

File size: 1.7 KB
Line 
1package require RapptureGUI
2
3set commondir [file join [file dirname [info script]] .. common]
4source [file join $commondir geovis_settings.tcl]
5
6set width 400
7set height 300
8wm geometry . ${width}x${height}
9update
10
11Rappture::MapViewer::SetServerList $GEOVIS_SERVERS
12set s [Rappture::MapViewer .g [list localhost:2015]]
13
14pack .g -expand yes -fill both
15
16# create a OSGeo WMS layer
17set dp1 [Rappture::GeoMapDataProviderWMS #auto \
18    {http://vmap0.tiles.osgeo.org/wms/vmap0} "basic" "jpeg" -transparent false]
19set l1 [Rappture::GeoMapLayerImage #auto $dp1 \
20        -label  "OSGeo WMS Layer" \
21        -description "base layer from OSGeo" \
22        -opacity 0.9 ]
23
24# create a Population Density 2000 layer
25set dp4 [Rappture::GeoMapDataProviderWMS #auto \
26    {http://sedac.ciesin.columbia.edu/geoserver/wms} \
27    "gpw-v3:gpw-v3-population-density_2000" "png" -transparent true]
28set l4 [Rappture::GeoMapLayer #auto $dp4 \
29        -label  "Population Density 2000" \
30        -description "Columbia Population Density 2000 Data" \
31        -opacity 0.9 ]
32
33# create a crop climate layer
34set dp5 [Rappture::GeoMapDataProviderWMS #auto \
35    {http://sedac.ciesin.columbia.edu/geoserver/wms} \
36    "crop-climate:crop-climate-effects-climate-global-food-production" \
37    "png" -transparent true]
38set l5 [Rappture::GeoMapLayer #auto $dp5 \
39        -label  "Crop Climate" \
40        -description "Columbia Crop Climate Data" \
41        -opacity 0.5 ]
42
43
44# create a map object
45set m [Rappture::Map #auto]
46
47# add all layers to the map object
48$m layer add -format blt_tree [$l1 export -format blt_tree]
49$m layer add -format blt_tree [$l4 export -format blt_tree]
50$m layer add -format blt_tree [$l5 export -format blt_tree]
51
52# add a map to the vis client
53$s scale $m
54$s add $m
Note: See TracBrowser for help on using the repository browser.