Bug report #13582

'Add Delimited Text Layer' not setting CRS query parameter in the URI

Added by ujaval gandhi over 4 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.8.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:21624

Description

When loading a CSV file using the Layer -> Add Delimited Text Layer, the default CRS is assumed as EPSG:4326. But this is not defined in the URI. This is a sample URI when you load the attached file in QGIS.

file:///C:/Users/Ujaval/Downloads/signif.txt?type=csv&delimiter=%5Ct&xField=LONGITUDE&yField=LATITUDE&spatialIndex=yes&subsetIndex=no&watchFile=no

The Layer CRS is defined correctly for delimited text layers. But if one queries for the Data Provider CRS, it returns an empty CRS value. The fTool plugin uses the dataProvider().crs() to determine the layer CRS and throws an error when using CSV layers.

I believe setting the crs parameter based on the selected CRS in the URI would fix this

file:///C:/Users/Ujaval/Downloads/signif.txt?type=csv&delimiter=%5Ct&xField=LONGITUDE&yField=LATITUDE&spatialIndex=yes&subsetIndex=no&watchFile=no&crs=EPSG:4326

signif.txt Magnifier (779 KB) ujaval gandhi, 2015-10-12 09:58 PM

History

#1 Updated by ujaval gandhi over 4 years ago

Attaching the text file.

#2 Updated by Alexander Bruy over 4 years ago

  • Status changed from Open to Feedback

Which fTools tool do you refer to? I checked in master with "Define current projection" and there is no error when using CVS file.

#3 Updated by ujaval gandhi over 4 years ago

The problem is with the fTools tools that use a CRS check. For example, if one layer is a CSV layer and another shapefile, the Points in Polygon tool gives a CRS warning even though the CRS is the same.

This is because the CRS check queries dataProvider().crs() which is empty for CSV layers. Also if you use 'Define current projection' tool and set the CRS, the next time you open the tool, the CRS still shows 'Missing of undefined'

#4 Updated by Giovanni Manghi about 4 years ago

  • Status changed from Feedback to Open

#5 Updated by Alexander Bruy over 3 years ago

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

CVS files does not have CRS definition in it. So provider CRS always none and only layer CRS makes sense.

Also available in: Atom PDF