Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. Name

*geo* -- Geographical coordinates handling {alias:geo}

h2. Syntax - Converting between coordinate systems
{panel:|borderStyle=solid|borderWidth=1|bgColor=#ffffaa}

*geo* \[*cvt*] \[*xy*] \[*lla*]

{panel}

h2. Syntax - Displaying geographical lines
{panel:|borderStyle=solid|borderWidth=1|bgColor=#ffffaa}

*geo dra* \[*lon*] \[*lat*] \[*cut*] \[*fra*] \[*col*] \[*set*]

{panel}

h2. Syntax - Annotate geographical axes
{panel:|borderStyle=solid|borderWidth=1|bgColor=#ffffaa}

*geo ann* 
{panel}

h2. 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).

h2. 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.

{noformat:|borderWidth=1|bgColor=#eeeeee}
        # Setting upper and lower geodesywidget into a tcl variables
	set ::cu [geodesywidget]
	set ::cl [geodesywidget]
{noformat}

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.

h2. Arguments
*geo cvt* \[*low*] *coord*
{indent}
Convert *active* data from *upper* to *lower*. Or the other way if *low* is used. The result is in *active*.

h3. 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.
 
{noformat:|borderWidth=1|bgColor=#eeeeee}
proc GcGeodesy::convertActiveDataFromUpperToLower { } {
	geodesywidget setasupper $::cu
	geodesywidget setaslower $::cl
	geo cvt coord
}
{noformat}

{indent}

*geo xy* _xcoordinate_ _ycoordinate_
{indent}
Convert a coordinate pair from *xy* to *Lon Lat* or from *Lon Lat* to *xy*.
{indent}
h3. Example showing coordinate conversion of one single point (coordinate pair)

{noformat:|borderWidth=1|bgColor=#eeeeee}
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]
	}
}
{noformat}

*geo xy | lla coord*
{indent}
Convert *active* data from *xy* to *Lon Lat* or from *Lon Lat* to *xy*.

h3. Example showing coordinate conversion of active data

{noformat:|borderWidth=1|bgColor=#eeeeee}
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
	}
}
{noformat}

{indent}


*geo dra* \[*lon*] \[*lat*] \[*cut*] \[*fra*] \[*col*] \[*set*]
{indent}
Draw geographical coordinates
{indent}
{indent}
*lon* _start stop increment_ 
{indent}

h3. Example showing coordinate conversion of active data

{noformat:|borderWidth=1|bgColor=#eeeeee}
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
	}
}
{noformat}

{indent}


h2. See also

[axe - Axes display]
{pagebreak}