proj geocoord

From DavinciWiki
Jump to: navigation, search

Description

Transform one set of coordinates to another projection

The default behavior is to transform lat/lon to image coordinates in x/y pixels

This function relies on GDAL > 1.8.

Arguments and Return Values

Arguments: A davinci Geo-Struct and XY coordinate list

Return Value: Coordinates in the new projection

Usage

Syntax: proj_geocoord(coords, [,Geo-Struct][,s_srs=STRING][,t_srs=STRING][,inverse=BOOL][,opts=STRING])

coords=array of points in the target projection (2xNx1)

Geo-Struct = davinci Geo-Struct

inverse=input units in the target, output units in the source (Default=1)

t_srs=projection of the target (Default='+proj=latlong +units=deg')

s_srs=projection of the source (Default=Geo-Struct projection)

opts=additional gdaltransform options (Default="")

NOTE: a GeoStruct and s_srs may not both be provided

Examples

Usage option 1: Map lat/long coords to an xy pixel in a GeoStruct

dv> geostruct=read_geo($DV_EX+"/test_geo.tiff")
Downloading.........done.
struct, 14 elements
   anc: struct, 10 elements
       wkt: Text Buffer with 14 lines of text
           1: PROJCS["unnamed",
           2:     GEOGCS["unnamed ellipse",
           3:         DATUM["unknown",
           4:             SPHEROID["unnamed",3396190,0]],
           5:         PRIMEM["Greenwich",0],
           6:         UNIT["degree",0.0174532925199433]],
           7:     PROJECTION["Equirectangular"],
           8:     PARAMETER["latitude_of_origin",0],
           9:     PARAMETER["central_meridian",0],
           10:     PARAMETER["standard_parallel_1",0],
       metadata: struct, 1 elements...
       proj4: "'+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0\
                +a=3396190 +b=3396190 +units=m +no_defs '"
       origin: 1x2x1 array of double, bsq format [16 bytes]
       pixel_size: 1x2x1 array of double, bsq format [16 bytes]
       lat: 1x5x1 array of float, bsq format [20 bytes]
       lon: 1x5x1 array of float, bsq format [20 bytes]
       lpo: 1x5x1 array of float, bsq format [20 bytes]
       spo: 1x5x1 array of float, bsq format [20 bytes]
       center: 2x1x1 array of float, bsq format [8 bytes]
   ignore: -32768.00000
   projection: "Equirectangular"
   spheroid: struct, 3 elements
       name: "unnamed"
       radius: "3396190"
       iflattening: "0"
   resolution: 1852.334351
   x: 0.000000000
   y: 640.0000000
   ul: 2x1x1 array of float, bsq format [8 bytes]
   ur: 2x1x1 array of float, bsq format [8 bytes]
   ll: 2x1x1 array of float, bsq format [8 bytes]
   lr: 2x1x1 array of float, bsq format [8 bytes]
   w: 640
   h: 640
   data: 640x640x1 array of float, bsq format [1,638,400 bytes]

dv> out=proj_geocoord(10//10,geostruct)
Writing /tmp/dv_24039/coordproj_data.tif.tmp.tiff: 640x640x1 TIFF file.
Attaching Ancellary Data to /tmp/dv_24039/coordproj_data.tif: 640x640x1 GeoTIFF File....Done.
2x1x1 array of double, bsq format [16 bytes]
319.9999866     320.0000134

Usage option 2: translate XY coordinates to any new projection, return units are in global projection units

dv> out=proj_geocoord(15//15,s_srs='+proj=latlong +units=deg',t_srs='+proj=eqc +units=m',inverse=0)
2x1x1 array of double, bsq format [16 bytes]
1669792.362     1669792.362

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Recent Library Changes

Created On: 05-14-2013
Modified On: 07-29-2013

Personal tools