On 05.07.2017 12:18, Even Rouault wrote:

On mercredi 5 juillet 2017 12:04:04 CEST Sandro Mani wrote:

> On 05.07.2017 11:30, Even Rouault wrote:

> > My feeling is that, for good or worse, they are definitely people

> > wanting to have QGIS and "put here the name of your favorite

> > proprietary GIS software" running at the same time, and possibly on

> > the same datasets. This is apparently important in migration scenarios

> > where people aren't ready yet to jump completely to QGIS. That said,

> > this is also tricky to do in a reliable way.

>

> Could ogr expose oldId -> newId information which the qgsogrprovider

> would then emit as a signal when the layer is repacked? I don't mean a

> persistent mapping, but just for the single repack operation.

That could potentially be done using the current OGR API. Basically in pseudo code, to execute before executing REPACK

OGR_L_ResetReading(layer)

char** ignored_fields = CSLAddString(NULL, "OGR_GEOMETRY" );

OGR_L_SetIgnoredFields( layer, ignored_fields); // for performance.

CSLDestroy(ignored_fields);

OGR_L_SetAttributeFilter( layer, NULL )

OGR_L_SetSpatialFilter( layer, NULL )

std::map<GIntBig, GIntBig> mapOldIdToNewId;

GIntBig newId = 0;

while( feature = OGR_L_GetNextFeature(layer) )

{

mapOldIdToNewId[OGR_F_GetFID(feature)] = newId;

newId ++;

OGR_F_destroy(feature);

}

OGR_L_SetIgnoredFields( layer, NULL );

Ok cool, that sounds like a plan - I'll give it a shot.

Thanks
Sandro

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to