MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

MapWinGIS:Shapefile PointInShape

From MapWindow GIS

Jump to: navigation, search

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://www.mapwindow.org/wiki/index.php/MapWinGIS:Shapefile_PointInShape"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: November 12 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links