GridProject
GridProject converts the coordinate system of a grid file from one system to another and saves the results to a new Grid object.
Syntax
object.GridProject( InGrid, InCS, OutGrid, OutFmt, OutCS, NumRows, NumCols, ResampleMethod, OutGridOptions )
Parameter |
Type |
Required/ Optional |
Default |
Description |
InGrid |
String |
Required |
|
This provides the path and file name of the input grid file to be projected. |
InCS |
String |
Optional |
InGrid's coordinate system, if specified |
The coordinate system of the input grid that is being projected. |
OutGrid |
String |
Optional |
"out.grd" |
The filepath of the output grid that was projected. |
OutFmt |
Optional |
srfGridFmtS7 |
The file extension (or type) for the output grid that was projected. |
|
OutCS |
String |
Required |
|
The coordinate system that the input grid will be projected to. |
NumRows |
Integer |
Optional |
The number of rows in the input grid |
The number of rows in the output grid. |
NumCols |
Integer |
Optional |
The number of columns in the input grid |
The number of columns in the output grid. |
ResampleMethod |
Optional |
srfBilinear |
The method we use to determine how the Z values for the output grid will be calculated. |
|
OutGridOptions |
String |
Optional |
"" |
This provides the output option string for the grid format. |
Remarks
Resizing the output grid will be false if neither NumRows nor NumCols are specified. If either of NumRows or NumCols is specified, then resizing the output grid will occur.
The InCS and OutCS parameters can be a name, token, or valid WKT for a coordinate system.
Example 1
This example demonstrates how to project "Colorado.grd" from it's internal coordinate system to the "Bonne Projection" coordinate system and save the file to "output.grd".
Surfer.GridProject(Surfer.Path + "\Samples\Colorado.grd", "Bonne Projection", OutGrid:="C:\Users\David\Downloads\output.grd")
Example 2
This example demonstrates how to change the projection for "Grand Canyon.grd" from "World Geodetic System 1972" to "Eckert IV" using its token and the Cubic Convolution resampling method. The output grid will be 124 x 118 and will be saved to "output.vtk".
Surfer.GridProject(Surfer.Path + "\Samples\Grand Canyon.grd", OutCS:="WORLD_ECKERT4", InCS:="World Geodetic System 1972", NumRows:=124, NumCols:=118, ResampleMethod:=srfCubic, _
OutGrid:="C:\Downloads\output.vtk", OutFmt:=srfGridFmtVTK)
Example 3
This example demonstrates how to convert the coordinate system to World Eckert 4, save the file as Project.grd and save the spatial reference as a Golden Software Reference (GSIREF) version 2 file.
Surfer.GridProject(InGridPath+"Telluride.grd", OutCS:="WORLD_ECKERT4", OutGrid:=OutGridPath + "Project.grd", OutGridOptions:="UseDefaults=1, ForgetOptions=1, SaveRefInfoAsGSIREF2=1")
Used by: Application object