Last change
on this file since 6285 was
6285,
checked in by ldelgass, 9 years ago
|
Fix examples for running with tclsh
|
File size:
1.4 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 | array set xyzParams { |
---|
20 | url {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg} |
---|
21 | } |
---|
22 | array set osm { |
---|
23 | label "OSM Map" |
---|
24 | description "MapQuest OpenStreetMap Street base layer" |
---|
25 | opacity 1.0 |
---|
26 | } |
---|
27 | |
---|
28 | # create an feature point layer from a csv file using the OGR driver |
---|
29 | # the longitude and latitude fields must be named "longitude" and |
---|
30 | # "latitude" respectively |
---|
31 | # |
---|
32 | # we add the local:// prefix to tell the map viewer widget that |
---|
33 | # the file exists locally and needs to be transferred to the |
---|
34 | # geovis server. |
---|
35 | # set path "local://coord.csv" |
---|
36 | set path "local://station_clean.csv" |
---|
37 | array set ogrParams [subst { |
---|
38 | url {$path} |
---|
39 | }] |
---|
40 | array set iconParams { |
---|
41 | label "CSV data" |
---|
42 | description "using OGR data provider to load data from a CSV file" |
---|
43 | style "-icon pin3" |
---|
44 | } |
---|
45 | |
---|
46 | # create a map object |
---|
47 | set map [Rappture::Map #auto] |
---|
48 | |
---|
49 | # add all layers to the map object |
---|
50 | $map addLayer image \ |
---|
51 | osm [array get osm] \ |
---|
52 | xyz [array get xyzParams] |
---|
53 | $map addLayer icon \ |
---|
54 | iconParams [array get iconParams] \ |
---|
55 | ogr [array get ogrParams] |
---|
56 | |
---|
57 | # add a map to the vis client |
---|
58 | $mapviewer scale $map |
---|
59 | $mapviewer add $map |
---|
Note: See
TracBrowser
for help on using the repository browser.