Last change
on this file since 6532 was
6285,
checked in by ldelgass, 8 years ago
|
Fix examples for running with tclsh
|
File size:
1.2 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 | # create an feature point layer from a csv file using the OGR driver |
---|
20 | # the longitude and latitude fields must be named "longitude" and |
---|
21 | # "latitude" respectively |
---|
22 | # |
---|
23 | # we add the local:// prefix to tell the map viewer widget that |
---|
24 | # the file exists locally and needs to be transferred to the |
---|
25 | # geovis server. |
---|
26 | # set path "local://coord.csv" |
---|
27 | set path "local://station_clean.csv" |
---|
28 | array set ogrParams [subst { |
---|
29 | url {$path} |
---|
30 | }] |
---|
31 | array set layerParams { |
---|
32 | label "CSV point data" |
---|
33 | description "using OGR data provider to load CSV point data" |
---|
34 | style "-color red -size 5" |
---|
35 | } |
---|
36 | |
---|
37 | # create a map object |
---|
38 | set map [Rappture::Map #auto] |
---|
39 | |
---|
40 | # add all layers to the map object |
---|
41 | $map addLayer point \ |
---|
42 | points [array get layerParams] \ |
---|
43 | ogr [array get ogrParams] |
---|
44 | |
---|
45 | # add a map to the vis client |
---|
46 | $mapviewer scale $map |
---|
47 | $mapviewer add $map |
---|
Note: See
TracBrowser
for help on using the repository browser.