Dissolve causes SelectShapes to give false positives

Apr 29, 2013 at 1:06 PM
After I create a (linear) shapefile via Dissolve, SelectShapes correctly selects expected shapes, but also sometimes selects shapes that are not within the selection box/specified extent. FixUpShapes does not help. It seems like the problem should be in the source shapefile, but I have tried the function on multiple shapefiles with the same result.

Many thanks to anyone who can provide assistance.

Don Rahmlow
Readfield, ME
US
Coordinator
May 1, 2013 at 12:18 PM
Can you provide the shapefile so we can try to reproduce?
May 1, 2013 at 12:47 PM
Paul, thanks very much for your offer. I’ve prepared an example that hopefully makes it easy to see the problem. If you extract this to a new folder c:\temp\PaulDissolve it should run without additional preparation required. The “Show Segments” operates on the shapefile before dissolving sections of a road into a single road shape. “Show Dissolved” of course shows results after the dissolve. If you draw some bounding boxes on the dissolved version at random that select no roads you will see some false positive selections before too long.

For example, if you click “Show Dissolved” then “Zoom +” three times and draw a box right below the label “Main St” that is just above and to the left of the center of the screen you should see Main St selected, even though the box does not cross Main St.

This certainly seems to be either a shapefile issue or something I’m doing wrong but I’ve tried other shapefiles with similar results and I based my example on the official bounding box sample from the doc so hopefully I am not wasting your time.

http://www.rsms.info/downloads/dissolve.zip

Again, thank you for looking at this!

Don Rahmlow
Readfield, ME
US
Coordinator
May 6, 2013 at 8:48 AM
Edited May 6, 2013 at 11:06 AM
Hi Don,

I can reproduce your problem.
When I create a third shapefile containing just a rectangle and I use the selectbox on the same location of the rectangle Main street which is not in my selection is selected as well.
When I use a spatial query: 'select dissolved shapes which intersect with rectangle' Main street isn't selected so no 'hidden' vertices are in the selection.

So it seems you've found a genuine bug ;)
I'll ask Sergei and Brad if they have time to look at it.

[Edit]
I've created a test script that reproduces this behavior:
http://svn.mapwindow.org/svnroot/TestingScripts/Shapefile_SelectShapes.cs

Thanks,

Paul
May 6, 2013 at 1:35 PM
Hi Paul, Thanks very much for taking the time to look at this. I'm sorry to have found a bug, but happy I was not wasting your time :) As always, thank you and the team for your terrific ongoing support of MapWinGIS. My appreciation of the product and all the hard work that has gone into it grows each time I use it.

Don
Coordinator
May 8, 2013 at 7:13 AM
Hi Don,

Sergei fixed the bug you've found.
You can get the new binaries using the procedure described here:
http://www.mapwindow.org/phorum/read.php?4,24284

Paul
May 8, 2013 at 2:01 PM
Hello Paul and Sergei,

Many, many thanks for your good work on this! I haven't been able to test it yet, though. Paul, I followed your instructions to download the latest build, but got the previous build 4.8.7.5 instead. The release notes, however, included 4.8.7.6 so SVN must be at least partially updated. Can you please let me know whether I'm doing something wrong? I will be excited to use the new Dissolve!

Thanks,

Don
Coordinator
May 9, 2013 at 9:11 AM
Hi Don,

Thanks for the kind words.
The problem was not with the dissolve method but with the selectShapes method.

I'm not sure about the version numbers, perhaps I haven't updated them yet ;)
If you've used Update2SVN.exe you should have the latest version.
Just open the dissolved shapefile and use the select button of MapWindow and drag a rectangle under Main Str. It should not select that street now.
The select button is using the fixed selectShapes method.
May 9, 2013 at 1:12 PM
Hi Paul,

Can you please check once more on your end. I have tried the Update2SVN process two more times, once on a "clean" machine and once on my development machine. In both instances the ocx version shows as 4.8.7.5, not .6, although the release notes do include 4.8.7.6. I tested the downloaded ocx and it behaves as it did before--false positives are selected by SelectShapes. So I'm pretty sure it is in fact the older version that is being downloaded.

There was one thing unexpected that occurred during the process, and that is that the utility (a very handy tool, by the way) reports that a newer version is available, but after downloading it again says a newer version is available. So I hit cancel and the process proceeded (seemingly normally) to completion, including registering the ocx.

Again, thanks very much for your kind assistance.

Don
Coordinator
May 14, 2013 at 3:05 PM
Hi Don,

I'll create new binaries in 24 hours. I'll check the version numbers and will check your problem as well.
I'll keep you posted.

Paul
May 14, 2013 at 3:59 PM
Hi Paul--Many thanks!!

Don
Coordinator
May 16, 2013 at 9:24 PM
Hi Don,

I've just committed new binaries.
Read here: http://www.mapwindow.org/phorum/read.php?4,24284,24383 how to easily update your binaries.
May 17, 2013 at 10:38 AM
Hi Paul,

The spurious selection issue appears to be solved, however I can't be sure as I am seeing unexpected behavior from Dissolve--it seems to have no effect. Have you had a chance to test the new binaries on the example code I sent you? That is the code that should show shapes merged based on the contents of the "rdname" field, and this is what I'm using to test the new binary. However, exercising the Dissolve method appears to be selecting only individual shapes, not a merged version.

Thank you for looking at this!

Don
May 17, 2013 at 11:33 AM
Paul, Please ignore my earlier msg. In further testing Dissolve seems to work, I'm not sure why my original test program is not working correctly, but clearly more research is required on my end, not yours. I'll advise re. outcome.

Thank you again,

Don
May 17, 2013 at 10:54 PM
Hi Paul,
4.8.7.6
I've done some further testing and it appears to me that the issue with SelectShapes has not been solved. My ocx says it is version 4.8.7.6, but when I run my test program drawing a box under Main Street selects Main Street as it did before. Perhaps I am doing something wrong--have you had a chance to test the new version with my test program?

Thank you,

Don
May 25, 2013 at 1:42 PM
Hi Paul,

I've tested on additional machines using the test program I sent you with version 4.8.7.6 and SelectShapes appears to have the same problem as before; i.e., selecting shapes that are not within the selection box extent. If you have a spare moment could you kindly repeat your testing and let me know what you see?

Thanks,

Don