Name
geo – Geographical coordinates handling
Syntax - Converting between coordinate systems
geo [cvt] [xy] [lla]
Syntax - Displaying geographical lines
geo dra [lon] [lat] [cut] [fra] [col] [set]
Syntax - Annotate geographical axes
geo ann
Syntax - Setting options for geographical coordinates
geo set
Description
Handling and display of geographical coordinates.
The geo command has a syntax for coordinate conversion and display of geographical coordinates. The geo command is for instance applied in the menu script geodesy.tcl that comes up from Tools > Geographical Management . In order to learn the command and practical use one can look into the script. (Look in the Geocap installation directory under the Geodesy module).
Geodesywidget
The geo command uses coordinate information from the menu. This is handled through a special widget called geodesywidget which is designed to be used in tcl scripts. One can think of geodesywidget as a complex tcl variable that contains the coordinate and datum information seen in the panel.
The conversion menu in Geodesy.tcl is organized in two parts: 1) upper and 2) lower . The conversion is from upper to lower or the other way. Active data is alway part of the conversion as the input dataset.
Due to the geodesywidget the script code for conversion and display of geographical coordinates is relatively small.
Below is shown how the tcl code reads the upper and lower geodesywidget into two global variables called cu and cl . Those variables can be used in conversion control later on.
# Setting upper and lower geodesywidget into a tcl variables set ::cu [geodesywidget] set ::cl [geodesywidget]
The statements above is written in the menu part where upper and lower is written. A change in a geodesywidget will then immediately update the global variables.
Arguments
geo cvt [low] coord
Convert active data from upper to lower. Or the other way if low is used. The result is in active.
Example showing coordinate conversion of a dataset
Active data will be converted from coordinates shown in upper to coordinates shown in lower geodesywidget. For this should work correct it is the users responsibility to secure that the coordinates in the upper geodesywidget is set correct to the coordinate system of active. Be aware that when a conversion command object is activated upon a dataset in the project, that dataset is make active before conversion starts.
proc GcGeodesy::convertActiveDataFromUpperToLower { } { geodesywidget setasupper $::cu geodesywidget setaslower $::cl geo cvt coord }
geo xy xcoordinate ycoordinate
Convert a coordinate pair from xy to Lon Lat or from Lon Lat to xy.
Example showing coordinate conversion of one single point (coordinate pair)
proc GcGeodesy::convertSinglePoint { } { geodesywidget setasupper $::cu if {$GcGeodesy::convertOptionSingle == "From XY to LongLat"} { set x $GcGeodesy::easting set y $GcGeodesy::northing geo xy $x $y set GcGeodesy::longitude [gvar gen longitude] set GcGeodesy::latitude [gvar gen latitude] } elseif {$GcGeodesy::convertOptionSingle == "From LongLat to XY"} { set x $GcGeodesy::longitude set y $GcGeodesy::latitude geo lla $x $y # the result is saved in tcl variables set GcGeodesy::easting [gvar gen xcoord] set GcGeodesy::northing [gvar gen ycoord] } }
geo xy | lla coord
Convert active data from xy to Lon Lat or from Lon Lat to xy.
Example showing coordinate conversion of active data
proc GcGeodesy::convertCoordinates { } { geodesywidget setasupper $::cu if {$GcGeodesy::convertOptionCoord == "From XY to LongLat"} { geo xy coord } elseif {$GcGeodesy::convertOptionCoord == "From LongLat to XY"} { geo lla coord } }
geo dra [lon] [lat] [inc] [cut] [fra] [col]
Draw geographical coordinates
lon | lat inc start stop increment - specify the start, stop and increment values for geographical lines.
cut - specify is the geographical lines is to be cut against the grid frame.
fra - specify is the grid frame is to be drawn.
col whi | red | yel ... - specify col of the geographical lines.
Trimmed example from geodesy.tcl of drawing geographical coordinate lines
proc GcGeodesy::detailedGeoDisplay { } { geodesywidget setasupper $::cu set cut " " if {$GcGeodesy::framecut == 1} {set cut cut} if {$GcGeodesy::applevelGrid == 1} {geo set geolev $GcGeodesy::levelGrid} if {$GcGeodesy::sticky_grid == 1} { geo set sticky set cut " " } set GcGeodesy::coordsys [geodesywidget getcoordinatesystem $::cu] eval geo dra $cut lon "$GcGeodesy::longitudeStart" "$GcGeodesy::longitudeStop" inc "$GcGeodesy::longitudeInc" lat "$GcGeodesy::latitudeStart" "$GcGeodesy::latitudeStop" inc "$GcGeodesy::latitudeInc" col $GcGeodesy::colorGeogrid geo set sticky off geo set geolev off }
geo ann updown annofreq
Draw geographical annotation
updown - may contain NE | SE | NESW to describe where annotation is placed.
annofreq - is a number from 1 to 6 to describe the annotation frequency.
Trimmed example from geodesy.tcl of drawing geographical annotation
proc GcGeodesy::annotateGeoGrid { } { geodesywidget setasupper $::cu if {$GcGeodesy::eraseGrid == 1} { acp id $GcGeodesy::annotationid del set GcGeodesy::annotationid 0 } set adjust [qischecked $GcGeodesy::adjustnumbers] # These Geocap variable enable fine adjustment of annotation numbers val g 396 0 val g 397 0 val g 398 0 val g 399 0 if {$adjust == 1} { val g 396 [expr $GcGeodesy::rightadjust * 0.1] val g 397 [expr $GcGeodesy::leftadjust * 0.1] val g 398 [expr $GcGeodesy::downadjust * 0.1] val g 399 [expr $GcGeodesy::upadjust * 0.1] } set GcGeodesy::coordsys [geodesywidget getcoordinatesystem $::cu] set geo "" if {$GcGeodesy::annotationFormat == "DDMMSS"} { val j 337 0 val j 391 0 } elseif {$GcGeodesy::annotationFormat == "DD"} { val j 337 2 val j 391 0 } elseif {$GcGeodesy::annotationFormat == "DD sign"} { val j 337 2 val j 391 0 set geo "nogeo" } elseif {$GcGeodesy::annotationFormat == "DD plain"} { val j 337 0 val j 391 1 } if {$GcGeodesy::ewnsFormat == 0} { val j 339 0 } else { val j 339 1 } if {$GcGeodesy::useannotationsize == 1} { val g 251 $GcGeodesy::sizeannotation } spe act on # use the old (already drawn) geo setting for the geographical lines geo set oldgeo eval geo ann $GcGeodesy::annUpDown $GcGeodesy::annfrequence $geo set rc [gvar rc] geo set oldgeo off geo set sticky off spe act off if {$rc == 1} { set GcGeodesy::annotationid [gvar actorid] } val g 251 1 val j 337 0 val j 339 0 val j 391 0 }
geo set [oldgeo | sticky | geolev]
Draw geographical coordinates
oldgeo [off] - use old (previous) position for geographical lines.
sticky [off] - specify that the geographical lines will be glued to sticky_surface.
geolev value - specify that the geographical lines will be displayed at height level value.
Display examples of map with geographical coordinates
The first example is from the workflow Seismic and reservoir models - Course B1.