loadthemall icon indicating copy to clipboard operation
loadthemall copied to clipboard

Unable to load point geometry in CSV files

Open biisager opened this issue 7 years ago • 4 comments

LoadThemAll loads the CSV files as "attribute-only" data. Currently, the dialog does not allow the user to specify the longitude/latitude fields which represents a point or to indicate a Point field.

Requesting ability to define lon/lat or point fields similar to something like the QGIS "Create a Layer From Delimited Text File" menu shown in two example jpg files.

  1. lon_lat_sample.jpg shows "Geometry definition" item with "Point coordinates" option selected lon_lat_sample

  2. point_sample.jpg shows "Geometry definition" item with "Well Known Text" option selected.
    point_sample

Sample csv, sample.csv.txt file is attached with comma delimiter where "lon" field represents longitude or X value and "lat" field represents latitude or Y value. The "Point" field represents the WKT geometry point field constructed from the "lon" and "lat" field. Hoping solution will also be able to recognize tab delimited fields.

sample.csv.txt

biisager avatar Jan 16 '18 04:01 biisager

Found code that shows how to pick up the "lon" and "lat" field:

# Find each .csv file and load them as vector layers
for fname in glob.glob("*.csv"):
    uri = "file:///" + path_to_csv + fname + "?delimiter=%s&crs=epsg:4326&xField=%s&yField=%s" % ("\t", "lon", "lat")
    name = fname.replace('.csv', '')
    lyr = QgsVectorLayer(uri, name, 'delimitedtext')
    QgsMapLayerRegistry.instance().addMapLayer(lyr)

biisager avatar Jan 16 '18 04:01 biisager

Note to self: https://github.com/qgis/QGIS/blob/a8de679601be931bd356a69f4b1cbb224581339d/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp#L107-L219

gacarrillor avatar Dec 21 '21 15:12 gacarrillor

hello, Do you plan to fix this problem and create a new version of this plugin ? I thank you in advance.

guilldet avatar Aug 16 '22 14:08 guilldet

@guilldet, thanks for raising this up.

I've had the plan in the past but nowadays there is no much free time to implement it. If you're able to fund the feature, that would speed things up. :+1:

gacarrillor avatar Aug 19 '22 18:08 gacarrillor