source: trunk/examples/mapviewer/ogr/ogr_shape_line_example.tcl @ 6285

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.2 KB
Line 
1package require Tk
2package require Rappture
3package require RapptureGUI
4
5Rappture::resources::load
6
7set commondir [file join [file dirname [info script]] .. common]
8source [file join $commondir geovis_settings.tcl]
9
10set width 400
11set height 300
12wm geometry . ${width}x${height}
13update
14
15set mapviewer [Rappture::MapViewer .g]
16
17pack .g -expand yes -fill both
18
19# create an feature line layer from a shape file using the OGR driver
20# we add the local:// prefix to tell the map viewer widget that
21# the file exists locally and needs to be transferred to the
22# geovis server. Because this is a shape file that could require
23# many other external files, all files that start with "afr_countries"
24# will also be transferred to the geovis server.
25set path "local://afr_countries.shp"
26array set ogrParams [subst {
27    url {$path}
28}]
29array set layerParams {
30    label  "African Countries Shape File (Line)"
31    description "Shape file with line data for African country borders"
32}
33
34# create a map object
35set map [Rappture::Map #auto]
36
37# add all layers to the map object
38$map addLayer line \
39    countries [array get layerParams] \
40    ogr [array get ogrParams]
41
42# add a map to the vis client
43$mapviewer scale $map
44$mapviewer add $map
Note: See TracBrowser for help on using the repository browser.