[GRASS-dev] A function for obtaining UTM coordinate

Glynn Clements glynn at gclements.plus.com
Sat Jul 26 09:13:06 EDT 2008


roberto caselli wrote:

> This is the prototype of the function 
> double G_col_to_easting           
>           (
>           double 
>            col, 
>           const struct Cell_head * 
>            window 
>           )

> For each cell I know the geographic decimal coordinate (for example
> -78.847804 , -2.814949) but what I'd like to know is its UTM
> coordinate (x=739254.864 , y=9688649.285594).
> 
> I don't know how using G_col_to_easting and G_row_to_northing to
> have these translations

If it is actually a cell of a GRASS raster map, then you also know its
row and column, which you can use with these functions.

If you want to transform arbitrary lat/lon coordinates to or from the
cartographic coordinate system used by the current location, see the
source code for v.proj for example code.

OTOH, if this doesn't actually involve GRASS in any way, you are
probably better off using the PROJ library directly. The only reason
to use the GRASS interface is if you want to use the projection
information from a location's PROJ_INFO file.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list