I am trying to build adjacency matrices for the features in a vector layer by testing the interconnections between the respective features. I have experienced some problems in using "MapWinGIS.SelectMode.INTERSECTION".
Basically I am using the following code;
Public Module MyExample
Public Sub ScriptMain(ByRef m_MapWin As IMapWin)
Dim sh as new MapWinGIS.shapefile
Dim handle As Long
dim s1 as new MapWinGIS.shape
Dim ArrayShpCount As Integer = 0
Dim ArrayShp(ArrayShpCount) As Integer
sh = CType(m_MapWin.Layers(handle).GetObject, MapWinGIS.Shapefile)
s1 = sh.shape(0)
sh.SelectShapes(s1.Extents, 0.0, MapWinGIS.SelectMode.INTERSECTION, ArrayShp)
The resulting Arrayshp does not include some IDs of the feature that actually intersect with the selected feature (s1). I attached a sample file to this message. If you try to select the features that intersect with s1 (ID=0) by using MapWinGIS.SelectMode.INTERSECTION, it could find any intersection between ID=0 and ID=4 features even through the respective features actually intersect each other.
I think some modifications are needed in the respective part of MapWindow GIS package to solve the problem associated with MapWinGIS.SelectMode.INTERSECTION.
Attachments: select1.rar (1.3 KB)
Do remember the shapes have an internal ID which don't need to be the same as your ID.
sf.SelectShapes() returns True is it finds one or more shapes.
Here's some documentation: [www.mapwindow.org]
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
Follow me on Twitter MapWindow_nl to read when a new installer is published.
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
View my profile on LinkedIn
By the way I am checking the intersection through internal ID of the features by employing the following code for each feature ID included in ArrayShp;
for j = 0 to ArrayShp.Length - 1
mapwinutility.logger.msg("Testing Intersection: " & ArrayShp(j))
for the first 4 features (0, 1, 2, 3) the result corresponds to the internal ID. But beginning from the 4th feature the correspondence between IDs is disturbed, signalling the failure in detection of the intersection between feature ID = 0 and feature ID = 4.