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 QuickPoints

From MapWindow GIS

Jump to: navigation, search

QuickPoints

Gets all of the points in the specified shape in the shapefile. Note: Use this method to get all of the specified points from a shape in the shapefile when speed is essential.


VB.NET Usage

Function QuickPoints(ShapeIndex As Integer, ByRef numPoints As Integer) As Double

            Parameters

ShapeIndex

The index of the shape for which all points are required.
numPoints Reference parameter. The number of points in the shape will be returned through this parameter.
ReturnValue An array of all the points in the specified shape will be returned. The points are ordered as follows: (x1, y1, x2, y2, ... , xn-1, yn-1, xn, yn) n = numPoints.

Sample Code

    Private Sub QuickPoints()
        Dim sf As New MapWinGIS.Shapefile()
        Dim point As New MapWinGIS.Point()
        Dim x() As Double, y() As Double, points() As Double
        Dim i As Integer, numpoints As Integer
        'Get the x and y coordinates of all points in shape 0 using the fastest method available
        points = sf.QuickPoints(0, numpoints)
        'Get the x and y coordinates of all points in shape 0 using the slowest method available
        For i = 1 To sf.Shape(0).numPoints
            'Get the current point in shape 0
            point = sf.Shape(0).Point(i)
            'Get the x and y coordinates of the current point
            x(i) = point.x
            y(i) = point.y
        Next
    End Sub
  

VB 6 Usage

Function QuickPoints(ShapeIndex As Long, ByRef numPoints As Long) As Double
            Parameters

ShapeIndex

The index of the shape for which all points are required.
numPoints Reference parameter. The number of points in the shape will be returned through this parameter.
ReturnValue An array of all the points in the specified shape will be returned. The points are ordered as follows: (x1, y1, x2, y2, ... , xn-1, yn-1, xn, yn) n = numPoints.

Sample Code

    Private Sub QuickPoints()
        Dim sf As New MapWinGIS.Shapefile
        Dim point As New MapWinGIS.point
        Dim x() As Double, y() As Double, points() As Double
        Dim i As Long, numpoints As Long
        'Get the x and y coordinates of all points in shape 0 using the fastest method available
        points = sf.QuickPoints(0, numpoints)
        'Get the x and y coordinates of all points in shape 0 using the slowest method available
        For i = 1 To sf.shape(0).numpoints
            'Get the current point in shape 0
            Set point = sf.shape(0).point(i)
            'Get the x and y coordinates of the current point
            x(i) = point.x
            y(i) = point.y
        Next
    End Sub

Retrieved from "http://www.mapwindow.org/wiki/index.php/MapWinGIS:Shapefile_QuickPoints"
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: December 03 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