Details

    • Type: Improvement
    • Status: To Do
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: v5.1.1.0
    • Fix Version/s: v5.4-Dev
    • Labels:
      None

      Description

      In 3 ways we can fix invalid shapes.
      I created unit tests for all 3.
      Using the same input file: a 700k polygon shapefile with 28 invalid shapes: 'Polygon must be clockwise'

      utils.FixUpShapes
      Needed time:

      00:02:06.6828228

      sf.FixUpShapes2
      Needed time:

      00:01:50.2094266

      shp.FixUp
      Needed time:

      00:00:38.3133595

      In my unit test for shp.FixUp I used Parallel.ForEach:

                  var stack = new ConcurrentStack<Shape>();
                  // Partition the entire source array.
                  var rangePartitioner = Partitioner.Create(0, sf.NumShapes);
                  // Loop over the partitions in parallel.
                  Parallel.ForEach(rangePartitioner, (range, loopState) =>
                  {
                      // Loop over each range element without a delegate invocation.
                      for (var i = range.Item1; i < range.Item2; i++)
                      {
                          var shp = sf.Shape[i];
                          Shape fixedShape;
                          shp.FixUp(out fixedShape);
                          stack.Push(fixedShape);
                      }
                  });
                  // Create output:
                  var sfOutput = sf.Clone();
                  foreach (var shape in stack)
                  {
                      sfOutput.EditAddShape(shape);
                  }
                  sfOutput.SaveAs(sfOutputLocation);
      

      In this code I don't copy the fields, that needs to be improved.

      Further investigation is needed if we can use Parallel.ForEach with a rangePartitioner in C++ as well.

        Attachments

          Activity

            People

            • Assignee:
              admin Paul Meems
              Reporter:
              admin Paul Meems
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: