ProjToCell
Converts a point in projected map coordinates to a cell (column,
row) in the grid. Note: If the point lies outside the bounds of the
grid, a column and row are returned which are outside the
boundaries of the grid. For example, if the point lies to the left
or lies below the grid boundaries, a negative column or row will be
returned. Similarly, if the point lies above or to the right of the
grid boundaries, a column or row which is greater than the number
of columns or rows will be returned.
VB.NET Usage
Sub ProjToCell(x As Double, y As Double, ByRef Column As Integer,
ByRef Row As Integer)
Parameters
x |
The x projected map coordinate for which the corresponding cell in the grid is required. |
y | The y projected map coordinate for which the corresponding cell in the grid is required. |
Column | Reference parameter. The column the specified point lies within. Note: This value may not be within the valid bounds of the grid. |
Row | Reference parameter. The row the specified point lies within. Note: This value may not be within the valid bounds of the grid. |
Sample Code
Private Sub ProjToCell() Dim grid As New MapWinGIS.Grid() Dim x As Double, y As Double Dim col As Integer, row As Integer 'Set the point in projected map coordinates x = 130000 y = 135000 'Open a grid from disk grid.Open("C:\grid.asc") 'Get the center of the cell in projected map coordinates stored in x and y grid.ProjToCell(x, y, col, row) 'Display column and row of the specified point in a message box MsgBox("The column and row of the point: col = " + Str(col) + " row = " + Str(row)) 'Close the grid grid.Close() End Sub
VB 6 Usage
Sub ProjToCell(x As Double, y As
Double, ByRef Column As Long, ByRef Row As Long)
Parameters
x |
The x projected map coordinate for which the corresponding cell in the grid is required. |
y | The y projected map coordinate for which the corresponding cell in the grid is required. |
Column | Reference parameter. The column the specified point lies within. Note: This value may not be within the valid bounds of the grid. |
Row | Reference parameter. The row the specified point lies within. Note: This value may not be within the valid bounds of the grid. |
Sample Code
Private Sub ProjToCell() Dim grid As New MapWinGIS.grid Dim x As Double, y As Double Dim col As Long, row As Long 'Set the point in projected map coordinates x = 130000 y = 135000 'Open a grid from disk grid.Open ("C:\grid.asc") 'Get the center of the cell in projected map coordinates stored in x and y grid.ProjToCell x, y, col, row 'Display column and row of the specified point in a message box MsgBox ("The column and row of the point: col = " + Str(col) + " row = " + Str(row)) 'Close the grid grid.Close End Sub