When executing a spatial query, such as an Intersection, an OGR result set may include multiple shape types (e.g. both SHP_POINT and SHP_MULTIPOINT), but there has not been an easy way to extract all of the results since Shapefiles are restricted to a single shape type.
With a few modifications, we can support multiple GetBuffer calls using different ActiveShapeType settings, and combine the results to get all of the intersecting geometry.
The normal process for extracting data from an OGR datasource is to call GetBuffer, which returns an in-memory Shapefile representation of the OGR Layer. In most cases, an OGR layer corresponds to a single Table, having a single Shapetype.
However, if the Layer is opened from a Query, or if you execute the OgrDatasource.RunQuery command, you will have a Layer that is not necessarily associated with a single Table, and therefore may consist of multiple Shape types in the single Layer. In this case, a call to GetBuffer will only return one set of shapes, since Shapefiles are restricted to one shape type. If you want to control which shape types are returned in the call to GetBuffer, you can set ActiveShapeType prior to calling GetBuffer. But you could not make multiple calls to ActiveShapeType followed by GetBuffer, because once the ActiveShapeType was set, it could not be modified.
Setting ActiveShapeType only affects the call to GetBuffer - it does not alter the original OGR data in any way. So a small change has been made that now allows for multiple calls to the ActiveShapeType/GetBuffer sequence, allowing for the retrieval of multiple sets of distinct shape types.
Additionally, in order to determine which shape types exist in the OGR layer, you can call OgrLayer.AvailableShapeTypes, which returns an array of ShpfileType enumerations (as an object). This method required a small change as well, since for MSSQL Datasources, the database itself was queried for the DISTINCT STGeometryType() FROM [tablename]. However, when dealing with the results of a Query, there is no specific Table, and so the result set was always empty.
So we now check whether or not the Layer is associated with a Table or with a Query, and if from a query, we evaluate the in-memory layer to get the complete list of available shape types.