Feature request #3414

Add Coordinate Reference System to memory provider and delim text provider uri

Added by Chris Crook over 10 years ago. Updated over 10 years ago.

Assignee:Gary Sherman
Category:Data Provider
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:13474


This patch adds the ability to specify the coordinate reference system in the datasourceUri for memory and delimited text providers.

The main intention in this is to allow plugins to create these providers with the CRS predefined, so that regardless of the QGIS default providers settings the layer can be created without displaying a reference system dialogue to the user.

Other changes made as part of this:
QgsCoordinateReferenceSystem string constructor has been generalised to allow strings such as "epsg:1234" as alternative to WKT
QgsMemoryProvider datasourceUri can also specify spatial indexing and attributes
QgsMemoryProvider and QgsDelimitedTextProviders uri's are encoded and decoded using QUrl rather than building as QString, to ensure reliable encoding of special characters
QgsDelimitedTextProvider UI tidied up to correctly remember delimiter settings in QSettings

crs_in_providers.diff Magnifier (23.9 KB) Chris Crook, 2011-01-24 05:13 PM


#1 Updated by Chris Crook over 10 years ago

Hold fire on this ...
Found a few issues so will put up a revised patch shortly :-(

#2 Updated by Chris Crook over 10 years ago

Should be good to go now...

#3 Updated by Chris Crook over 10 years ago

And forgot to update the SIP file for QgsCoordinateReferenceSystem. Now included too...

#4 Updated by Chris Crook over 10 years ago

Fixed bug in patch - mSkipLines was not being initiallized, resulting in arbitrary behaviour when not defined in URI.

#5 Updated by Chris Crook over 10 years ago

Found and fixed another bug in delimited text provider. Not related directly to this change, but expedient to include with this. Bug causes to QGIS to crash when reading empty wkt strings. Crash caused in nextFeature where it will attempt to check extents of a null geometry feature.

#6 Updated by Gary Sherman over 10 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Patch applied in dfb0602f (SVN r15075) - thanks!

Also available in: Atom PDF