Hi list -

I have a problem with the "QgsVectorLayerExporter" function in Python.

When I create a table like this (All parameter is of course set correctly and "options" is an empty dictionary {}):

vle = QgsVectorLayerExporter(uri.uri(), 'postgres' , myFields, myGeom, QgsCoordinateReferenceSystem("EPSG:4326"),False,options)

I get a nice table in my Postgres database with the correct fields, primary key and geometry field with the correct type. However I'm missing a spatial index on my geometry field.

I've tried with setting the "options" dictionary like this:

# Experiment for getting spatial index. Tried with 1, True ...
options = {}
options['spatial_index'] = 'on'

But that doesn't work either. As far as I can decipher the c++ code behind "QgsVectorLayerExporter", all tables created with the function *should* be created with a spatial index - except for dataprovider types ogr/GPKG  and ogr/Spatialite

So my question is: How can I get a spatial index on my new created table (or during creation) *without* having some database-type specific code directly creating the index using SQL ?

--
Med venlig hilsen / Kind regards

Bo Victor Thomsen

_______________________________________________
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