MapWinGIS:Shapefile PointInShape

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

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

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:Shapefile_PointInShape"

This page has been accessed 3,428 times. This page was last modified on 9 November 2005, at 18:26.