source: branches/geomap/examples/mapviewer/placard/placard_example.tcl @ 5993

Last change on this file since 5993 was 5993, checked in by dkearney, 9 years ago

adding examples for feature selection callback and placard configuration

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 an XYZ world layer
17set dp1 [Rappture::GeoMapDataProviderXYZ #auto \
18    {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg}]
19set l1 [Rappture::GeoMapLayerImage #auto $dp1 \
20        -label  "OSM Map" \
21        -description "MapQuest OpenStreetMap Street base layer" \
22        -opacity 1.0 ]
23
24# create an feature point layer from a csv file using the OGR driver
25# the longitude and latitude fields must be named "longitude" and
26# "latitude" respectively
27#
28# we add the local:// prefix to tell the map viewer widget that
29# the file exists locally and needs to be transferred to the
30# geovis server.
31# set path "local://[file join [file dirname [info script]] coord.csv]"
32set path "local://[file join [file dirname [info script]] station_clean.csv]"
33set dp2 [Rappture::GeoMapDataProviderOGR #auto icon $path]
34set l2 [Rappture::GeoMapLayer #auto $dp2 \
35        -label  "CSV data" \
36        -description "using OGR data provider to load data from a CSV file" \
37        -placardattributes {latitude Lat longitude Lon} \
38        -placardstyle {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} \
39        -placardpadding 5 \
40        ]
41
42# create a map object
43set m [Rappture::Map #auto]
44
45# add all layers to the map object
46$m layer add -format blt_tree [$l1 export -format blt_tree]
47$m layer add -format blt_tree [$l2 export -format blt_tree]
48
49# add a map to the vis client
50$s scale $m
51$s add $m
Note: See TracBrowser for help on using the repository browser.