source: trunk/examples/mapviewer/ogr/ogr_csv_points_example.tcl @ 6532

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 
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 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"
27set path "local://station_clean.csv"
28array set ogrParams [subst {
29    url {$path}
30}]
31array 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
38set 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.