source: trunk/examples/mapviewer/ogr/ogr_csv_icon_example.tcl @ 6370

Last change on this file since 6370 was 6370, checked in by dkearney, 6 years ago

adding feature multiple selection examples, not all ideas work right now.
using the afr_elas shapefile because they include country elasticity values from the landuse tool.
adding an example of using large stylesheets with multiple colors.
adding example of performing multiple selection by:

  1. deleting and adding a layer by the same name
  2. using a callback
  3. updating a layer with map object's addSelector method and mapviewer's refresh method.
File size: 1.4 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
19array set xyzParams {
20    url {http://otile[1234].mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg}
21}
22array set osm {
23    label "OSM Map"
24    description "MapQuest OpenStreetMap Street base layer"
25    opacity 1.0
26}
27
28# create a feature icon 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"
36set path "local://station_clean.csv"
37array set ogrParams [subst {
38    url {$path}
39}]
40array 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
47set 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.