Parallel.ForEach - Access Violation: 'Attempted to read or write protected memory' #92
-
I have millions of points which I have been transforming using this library, which works great. Because there are so many points to transform, I would like to use parallelism, using I can see that the CoordinateTransformation class takes an optional options parameter: CoordinateTransformationOptions, which takes some pointers, but I'm not sure how to get this working/if it is even a fix to the above. Example code: var transformation = new CoordinateTransformation(fromCS, toCS);
Parallel.ForEach(points, point => {
var transformedPoint = new double[3];
transformation.TransformPoint(transformedPoint, point.x, point.y, point.z);
}); I know you can pass in an array of points, which will most likely be more efficient, but what I'm doing involves several other calculations on each point, e.g. multiplying it by a matrix, creating a new vertex, and assigning it to a Mesh. Is it possible to achieve parallelism using Gdal? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That API only supports one point for a method call. Also, there can be issues with P/Invoke thread safety. In my opinion, it's better to use Gdal.Warp or GDALVectorTranslate for this purpose. You can also consider using a native library ProjNet. |
Beta Was this translation helpful? Give feedback.
That API only supports one point for a method call. Also, there can be issues with P/Invoke thread safety. In my opinion, it's better to use Gdal.Warp or GDALVectorTranslate for this purpose. You can also consider using a native library ProjNet.