1 | package require RapptureGUI |
---|
2 | |
---|
3 | set commondir [file join [file dirname [info script]] .. common] |
---|
4 | source [file join $commondir geovis_settings.tcl] |
---|
5 | |
---|
6 | set width 400 |
---|
7 | set height 300 |
---|
8 | wm geometry . ${width}x${height} |
---|
9 | update |
---|
10 | |
---|
11 | Rappture::MapViewer::SetServerList $GEOVIS_SERVERS |
---|
12 | set s [Rappture::MapViewer .g [list localhost:2015]] |
---|
13 | |
---|
14 | pack .g -expand yes -fill both |
---|
15 | |
---|
16 | # create an XYZ world layer |
---|
17 | set dp1 [Rappture::GeoMapDataProviderXYZ #auto \ |
---|
18 | {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg}] |
---|
19 | set 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]" |
---|
32 | set path "local://[file join [file dirname [info script]] station_clean.csv]" |
---|
33 | set dp2 [Rappture::GeoMapDataProviderOGR #auto icon $path] |
---|
34 | set 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 |
---|
43 | set 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 |
---|