I'm upgrading a QGIS plugin that I've written for farmers (GeoDataFarm) and I wounder if it is possible to disable the warning of temporary scratch layers on close project that was added in QGIS 3.2?

I use the scratch layer for the user to draw the field on the map, then I use the polygon in wkt format to store the data on a Postgres database. A more elegant solution might be to remove my memory layer and add it again. Hmm, any thoughts?

Here is some of my code (only some tiny bits to make sense of my question).

Close project warning

def add_field(self):
    self.field = QgsVectorLayer("Polygon?crs=epsg:4326", name, "memory")

def save_field(self):
    feature = self.field.getFeature(1)
    polygon = feature.geometry().asWkt()
    self.db.execute_sql('insert into fields (geom) values (st_geomfromtext('{wkt}', 4326)'.format(wkt=polygon))
  • If it turns out there's no way to disable this warning, consider making a feature request. – csk Oct 8 '18 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.