getPoints() for all Geometry classes
|Reported by:||Marvin||Owned by:||warmerdam|
|Severity:||critical||Keywords:||cost getPoint() getPoints() java bindings multi-part single-part speed|
could you please implement a method getPoints() for several sub-classes of the OGRGeometry class? I am talking of the following classes in particular:
OGRPoint OGRMultipoint OGRLineString OGRMultiLineString OGRPolygon OGRMultiPolygon
For all these classes, a getPoints() method could return a data structure of type double.
In case of OGRMultiLineString and OGRMultiPolygon it could be double, with the first dimension indicating the sub-geometry of a multipart geometry, the second dimension indicating the point of that sub-geometry and the third dimension the coordinates.
In all other cases mentioned, it could return a double, with the first dimension indicating the point of the geometry and the third dimension the coordinates.
I know getPoints() already exists for OGRLineString. But such a method is clearly missing for the other geometry classes mentioned. Would be very nice to have them.
The background: I am trying to lay the foundations for a Geometry.getPoints() method in the Java bindings that can work with just a single call to the native GDAL library. Currently, one would have to call getPoint(int i) of the native GDAL library repeatedly for each single point of a geometry at an enormous cost. Solving the problem within the original GDAL implementation first, i.e. at the root of the problem, would make the speed enhancement of the bindings easy, since they could rely on existing convenience methods in the native GDAL libraries.