This project is read-only.

No ideas about Geoprocessing usage?

Jul 30, 2013 at 3:36 PM
Edited Jul 30, 2013 at 3:39 PM
Does the Shapefile "Difference" method work? Are there any known limitations that would prevent it from working? What is the proper syntax / usage for using this method? I am trying to perform a Difference operation between two shapefile layers - one is Polygon-based, and the other is Polyline-based

It's very important to know if this method works. If it doesn't, I need to move on to another solution.

Jul 31, 2013 at 6:01 PM
The difference method should work. But I'm not sure if it works with a polygon and polyline.
Which difference do you want to calculate.

Are the polylines closed? If so you could make polygons out of them. That should work better.
Here's an example of the usage of Difference:
It is however using only polygons.

Aug 6, 2013 at 8:20 PM
Edited Aug 6, 2013 at 8:57 PM
Ok. So it looks like the geoprocessing functions really don't work correctly. In a typical GIS system, one can perform a Difference operation on a polyline shapefile and a polygon shapefile. I do this routinely in QGIS. However, the Difference function in MapWinGIS produces an unreliable result that does not reflect the true "difference".

If I have a road network of polylines, and I want to overlay this with a set of polygons and perform a Difference (or a Clip, or anything else), the result should be a set of new polylines that have the sections overlayed by the polygons clipped from the lines. This is useful if you want to create a new road layer that shows where a viewshed polygon overlay impacts the ability to see certain segments of the road.

It's really too bad. Geoprocessing functions are central to a GIS system, and an inability to perform these functions reliably is regrettable.
Aug 7, 2013 at 1:09 PM
Edited Aug 7, 2013 at 1:10 PM
Did you try to clip option?
You should be able to clip the roads with your polygons.
Here's the documentation:

Aug 7, 2013 at 2:41 PM
I sure did, which is even more odd. The Difference operation works, but produces an inaccurate result. However, the Clip operation fails entirely, as does the Intersect. They both fail no matter what order the two shapefiles are provided to the method.
Aug 7, 2013 at 6:17 PM
Just as a follow up, I converted the road polylines into polygons by using the BufferByDistance method. I thought that this might be an alternative since the Clip method was having problems with a polyline shapefile and a polygon shapefile. So, I thought that the Clip function should work on a polyline shapefile that was used in conjunction with the Buffer method to create a polygon representation of the roads. Then, the Clip function should work with two polygon shapefiles. it doesn't.


By the way, I am familiar with all of the API documentation. I have read through most of it many times - thanks.
Aug 8, 2013 at 9:22 PM
Edited Aug 8, 2013 at 9:31 PM
Ok....I just did a test and I verified that it is a multipart geometry problem.

The Shapefile class is providing the correct number of shapes. In this particular case, it is one feature (shape) that consists of 870 parts, each part being a little polygon. So, the geoprocessing functions do not work correctly on multipart geometries. I verified this by converting the multipart shapefile into a single part shapefile. Voila!, the Shapefile.Clip method works correctly and the Shapefile.NumShapes gives the correct number of single parts.

This is what I was trying to determine from the beginning with my initial question: "Do the geoprocessing functions have any limitations?"

Please....from now on answer with, "YES - THEY CANNOT HANDLE MULTI-PART GEOMETRIES"
Aug 9, 2013 at 7:51 AM
Thanks for the follow ups.

Can you share your data so I can reproduce and we can try to make a fix?
You can send it to bontepaarden[AT]gmail[D0T]com