-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gdal 2.0.0 #20627
Comments
Author Name: Mark Johnson (Mark Johnson) For setSubsetString, the 'OGRSQL' parameter must be used on layers that use the 'table_name(field_name)' convention. this matter was talked about in the gdal ticket: http://trac.osgeo.org/gdal/ticket/5903 and the final conclusion of Even Rouault was that this code must be adapted to work correctly with gdal 2.0 in cases where there is more than 1 geometry in a table. |
Author Name: Giovanni Manghi (@gioman) Hi, many thanks for this. I would appreciate a lot if you could raise this issues also on the qgis developers mailing list and/or on qgis github repo with a patch. Thanks!
|
Author Name: Mark Johnson (Mark Johnson) Since I cannot compile the present version, creating a patch is difficult since there are other changes in the file. |
Author Name: Paolo Cavallini (@pcav)
|
Author Name: Jürgen Fischer (@jef-n)
|
Author Name: Mark Johnson (Mark Johnson) This matter needs to be resolved for QGIS 3.
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Nyall Dawson (@nyalldawson) Fixed in QGIS 3
All of the changes are in in the functions
Also there is a problem in
All 3 cases effect only table that have MORE than 1 geometry. Up to gdal 1.11.2, each geometry field is treated as 1 layer. For QgsOgrProvider::getOgrGeomType only one line must be changed: geomType = OGR_FD_GetGeomType( fdef ); to: geomType = OGR_GFld_GetType(OGR_FD_GetGeomFieldDefn(fdef, 0)); For subLayers() it is a bit more comlecated, since now 2 loops are needed
if ( !mSubLayerList.isEmpty() ) return mSubLayerList; int layer_number=0; // depending on the gdal-version being used, the final result may be different that the result of layerCount() int layer_count=layerCount(); for ( int i = 0; i < layer_count ; i++ ) { OGRLayerH layer = OGR_DS_GetLayer( ogrDataSource, i ); OGRFeatureDefnH fdef = OGR_L_GetLayerDefn( layer ); QString theLayerName = FROM8( OGR_FD_GetName( fdef ) ); int fieldCount=OGR_FD_GetGeomFieldCount(fdef); for(int j=0; j
Also there is a problem in
All 3 cases effect only table that have MORE than 1 geometry. Up to gdal 1.11.2, each geometry field is treated as 1 layer. For QgsOgrProvider::getOgrGeomType only one line must be changed: geomType = OGR_FD_GetGeomType( fdef ); to: geomType = OGR_GFld_GetType(OGR_FD_GetGeomFieldDefn(fdef, 0)); For subLayers() it is a bit more comlecated, since now 2 loops are needed
if ( !mSubLayerList.isEmpty() ) return mSubLayerList; int layer_number=0; // depending on the gdal-version being used, the final result may be different that the result of layerCount() int layer_count=layerCount(); for ( int i = 0; i < layer_count ; i++ ) { OGRLayerH layer = OGR_DS_GetLayer( ogrDataSource, i ); OGRFeatureDefnH fdef = OGR_L_GetLayerDefn( layer ); QString theLayerName = FROM8( OGR_FD_GetName( fdef ) ); int fieldCount=OGR_FD_GetGeomFieldCount(fdef); for(int j=0; j |
Author Name: Mark Johnson (Mark Johnson) Are you sure this has been corrected? fdef.GetGeomFieldCount() will return the amount, thus a loop should exist from 0 to amount
This code retrieves only the first, so if more than one exists the others will not be listed.
|
Author Name: Mark Johnson (Mark Johnson)
Original Redmine Issue: 12479
Affected QGIS version: 2.8.1
Redmine category:data_provider/ogr
Assignee: Nyall Dawson
I have been working with the gdal 2.0.0 development code for a while and have noticed that due to the implementation of gdal RFC 41, code changes will be needed so that qgis will react in the same way with bot gdal 1.* and 2.*.
All of the changes are in
src/providers/ogr/qgsogrprovider.cpp
in the functions
Also there is a problem in
where the needed dialect parameter is set to NULL instead of "OGRSQL"
All 3 cases effect only table that have MORE than 1 geometry.
Up to gdal 1.11.2, each geometry field is treated as 1 layer.
Starting with gdal 2.0 each table is treated a 1 layer and the geometry fields of that table must be retrieved.
For QgsOgrProvider::getOgrGeomType only one line must be changed:
from:
to:
For subLayers() it is a bit more comlecated, since now 2 loops are needed
All of the OGR function used existed in both in gdal 1.* and 2..
The main difference between 1. and 2.0 is that label-name syntax 'table_name(field_name)'
in 1.: may only be used in a table with more than 1 geometry
in 2. may be used for all geometries fields
Unfortunately I cannot test this on the present master code, since I cannot get it compiled.
This is the reason I have not submitted a diff or pull request.
These changes were tested on the qgis that I use and can compile (2.1.0) and return that same result when using gdal 1.11.2 and the present gdal 2.0.0dev code.
I have, however, looked a the ogr specific code in the areas that were change and it looksthe same to me.
The only difference is that now a ```if ( wkbFlatten( layerGeomType ) != wkbUnknown )
The text was updated successfully, but these errors were encountered: