-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGDAL_Positional.tcl
More file actions
70 lines (60 loc) · 2.22 KB
/
Copy pathGDAL_Positional.tcl
File metadata and controls
70 lines (60 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# the next line restarts using tclsh \
exec $SPI_PATH/tclsh "$0" "$@"
#============================================================================
# Environnement Canada
# Centre Meteorologique Canadien
# 2100 Trans-Canadienne
# Dorval, Quebec
#
# Projet : Exemple de scripts.
# Fichier : GDAL_Basic.tcl
# Creation : Mai 2000 - J.P. Gauthier - CMC/CMOE
# Description: Demonstration de base des fonctions GDAL pour les donneees raster
#
# Parametres :
#
# Retour:
#
# Remarques :
#
#============================================================================
package require TclData
#package require TclGeoEER
package require Logger
Log::Start [info script] 0.1
#----- Ouverture du fichier
set bands [gdalfile open GDAL read $env(CI_DATA_IN)/SAR.tif]
puts " found: \n\t[join $bands \n\t]"
#----- Lecture des bandes
gdalband read RASTER [list [lindex $bands 0]]
gdalband read LAT [list [lindex $bands 4]]
gdalband read LON [list [lindex $bands 5]]
#----- converions pixel-latlon et inverse
set ll [gdalband stats RASTER -project 100 100]
set xy [gdalband stats RASTER -unproject [lindex $ll 0] [lindex $ll 1]]
puts " Before positionnal:"
puts " LL->XY : $ll = $xy"
puts " Min : [gdalband stats RASTER -min]"
puts " Max : [gdalband stats RASTER -max]"
#----- Assigner les latlon
puts "\n Corner latlon (0,0)=[gdalband stats LAT -gridvalue 0 0] [gdalband stats LON -gridvalue 0 0]\n"
gdalband define RASTER -positional LON LAT
#----- converions pixel-latlon et inverse
set ll [gdalband stats RASTER -project 100 100]
set xy [gdalband stats RASTER -unproject [lindex $ll 0] [lindex $ll 1]]
puts " After positional:"
puts " LL->XY : $ll = $xy"
puts " Min : [gdalband stats RASTER -min]"
puts " Max : [gdalband stats RASTER -max]"
#----- Configure the associated map to the limits of the data (if running in SPI)
catch {
set map [gdalband configure RASTER -colormap]
colormap configure $map -min red [lindex [lindex [gdalband stats RASTER -min] 0] 0]
colormap configure $map -max red [lindex [lindex [gdalband stats RASTER -max] 0] 0]
#----- Display
projection configure $Page::Data(Frame) -data RASTER
#Mapper::UpdateData $Page::Data(Frame) RASTER
}
gdalfile close GDAL
Log::End