MapWinGIS:Shapefile PointInShape
From MapWindow GIS
PointInShape
Checks to see if a point lies within the specified shape. This function only applies to polygon shapefiles.
VB.NET Usage
Function PointInShape(ShapeIndex As Integer, x As Double, y As Double) As Boolean
Parameters
|
ShapeIndex | The index of the shape to be tested. |
| x | The x coordinate in projected map units of the point to be tested. |
| y | The ycoordinate in projected map units of the point to be tested. |
| ReturnValue | A boolean value representing whether the point lies within the specified shape or not. |
Sample Code
Private Sub PointInShape()
Dim sf As New MapWinGIS.Shapefile()
Dim x As Double, y As Double
'Set the values for x and y in projected map coordinates
x = 3000
y = 2500
'Check if the point lies within shape 0 in the shapefile
If sf.PointInShape(0, x, y) Then
'Display message in message box
MsgBox("The point lies inside the specified shape.")
Else
'Display message in message box
MsgBox("The point does not lie inside the specified shape.")
End If
End Sub
VB 6 Usage
Function PointInShape(ShapeIndex As Long, x As Double, y As Double) As Boolean
Parameters
|
ShapeIndex | The index of the shape to be tested. |
| x | The x coordinate in projected map units of the point to be tested. |
| y | The ycoordinate in projected map units of the point to be tested. |
| ReturnValue | A boolean value representing whether the point lies within the specified shape or not. |
Sample Code
Private Sub PointInShape()
Dim sf As New MapWinGIS.Shapefile
Dim x As Double, y As Double
'Set the values for x and y in projected map coordinates
x = 3000
y = 2500
'Check if the point lies within shape 0 in the shapefile
If sf.PointInShape(0, x, y) Then
'Display message in message box
MsgBox ("The point lies inside the specified shape.")
Else
'Display message in message box
MsgBox ("The point does not lie inside the specified shape.")
End If
End Sub
















