[Qgis-user] multiple csv file import

Mike Hyslop mdhyslop at mtu.edu
Tue Nov 15 12:08:33 PST 2022


This has been covered in StackExchange:
https://gis.stackexchange.com/questions/276590/bulk-csv-to-shapefile-using-ogr2ogr

Determine the correct ogr2ogr syntax for processing one of your .csv files.
If on Windows, issue the command *ls *.csv > files.txt    *This will 'list'
all of your csv files but will save them to a text file named *files.txt*.
You can then use Excel to clone your correct command syntax while changing
the input (drawn from files.txt) and output filenames (these can also be
taken from the input filenames). Save the excel sheet as a text file and
feed it to ogr2ogr - it will process each line sequentially until all files
have been converted.

Best,
Mike

On Tue, Nov 15, 2022 at 2:58 PM Hugh Kelley via Qgis-user <
qgis-user at lists.osgeo.org> wrote:

> David, this was my first thought when i saw this question as well.
>
> however, I didn't look for very long but I haven't seen a way to tell
> ogr2ogr to read columns in a csv as the lat/lon and write those as points
> to the shapefile.  I generally write a csv to postgres as a non-spatial
> table and then process the lat lon columns with postgis.
>
>  Are there arguments for ogr2ogr that can do this?
>
> On Tue, Nov 15, 2022 at 12:30 PM David Strip via Qgis-user <
> qgis-user at lists.osgeo.org> wrote:
>
>> You might consider ogr2ogr as an alternative approach. You can run this
>> from the command line allowing you to use shell scripts to iterate through
>> all your .csv files. There are also python bindings for ogr2ogr if you're
>> more comfortable with python than shell scripts.
>>
>> On 11/15/2022 9:59 AM, Salvatore Mellino via Qgis-user wrote:
>>
>> Hello,
>>
>> thank you for your answer. I have many csv (about 100), so I need an
>> automatic procedure. Maybe a python script...
>>
>> Il 15/11/2022 16:55, Nicolas Cadieux ha scritto:
>>
>> Hi,
>>
>> Yes, you can do that very easily using QGIS.  Layer/add layer/add
>> delimited text layer.  Then just export the layer in the format of your
>> choice. You may need to convert the coordinates in decimal degrees (ex 75
>> 05 30.4 -> 75.0917777777778000000 ).
>>
>> You can do this in Excel using =(A6)+(B6/60)+(C6/3600)+(D6/3600) A= Deg,
>> B= Min, C=Sec, D= Decimal Sec.  Then export to csv.
>>
>> Nicolas
>>
>>
>> On 2022-11-15 10:08 a.m., Salvatore Mellino via Qgis-user wrote:
>>
>> Hello,
>>
>> I would like to know if it is possible to import multiple csv files
>> contained in a folder and to convert them in shapefiles (1 for each csv).
>> All csv files are structured as "lat long value" separate by space and
>> without any header line.
>>
>> Thank you for your help! Regards,
>>
>> Salvatore
>>
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
> --
> Hugh Kelley
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20221115/82d0043e/attachment.htm>


More information about the Qgis-user mailing list