[Qgis-user] Import lines from cvs

Matthias Kuhn matthias at opengis.ch
Fri Jan 8 00:07:48 PST 2016


Hi Joris

On 01/07/2016 10:14 PM, Joris Hintjens wrote:
> Thanks Nyall,
> 
> I try to understand your procedure, but…:
> 
> line3: “save as…”: Before doing that, I already need a geometry defined, a proces you describe later i the process. I don’t get it.

Note the "with all null geometries" comment in 5. This will just prepare
an empty container which will be filled later.

> line 4: "- expand out the "Geometry” group…”  This is an option from the “load csv layer”, not from “save layer as (shape)”

... I see it as well in "save as"

> line 8: change field to <geom>: which field?  I lost you there completely. Sorry.

Where you should specify a field name

> 
> 
> 
>> Op 7 jan. 2016, om 02:47 heeft Nyall Dawson <nyall.dawson at gmail.com> het volgende geschreven:
>>
>> On 7 January 2016 at 07:08, Joris Hintjens <jorishin at gmail.com> wrote:
>>> Hello,
>>> I’m lost.
>>> I have a list of movements. A table with (among others) a column “FROM”  and a column “TO” (both containing coordinates)
>>>
>>> How can I import this in QGIS so that I have a bunch of lines going from FROM to TO?
>>>
>>
>> This is relatively straightforward in QGIS master:
>>
>> 1- import your CSV file
>> 2- right click the CSV layer, and choose "Save as"
>> 3- change format to "ESRI Shapefile". Choose the correct CRS for your
>> coordinates.
>> 4- expand out the "Geometry" group and change "Geometry type" from
>> "Automatic" to "LineString"
>> 5- click OK, the new LineString shapefile (with all null geometries)
>> will be added to the project
>> 6- now, you need to create the geometries. This is done through the
>> field calculator.
>> 7- tick "update existing field"
>> 8- change the field to "<geometry>"
>> 9- enter the expression:
>> 'make_line(make_point("x1","y1"),make_point("x2","y2"))' (but replace
>> x1, y1, ... with the correct columns names from your original CSV
>> file)
>> 10- click OK. Done!
>>
>> Nyall
>>
>>
>>> thanks for your comments
>>>
>>> Joris
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
> 



More information about the Qgis-user mailing list