[Qgis-user] Adding coordinates to layer

DelazJ delazj at gmail.com
Mon Dec 2 22:20:57 PST 2024


Hello,

Le 3 décembre 2024 00:36:20 GMT+01:00, Ludwig Kniprath via QGIS-User <qgis-user at lists.osgeo.org> a écrit :
>Hi Pat,
>
>
>Step 1 (already done): import csv as "Delimited Text Layer". Since there are no coordinates this results in a geometry-less layer.
>
>Step 2: export and load the just imported csv as vector-layer (GeoPackage, Shape), geometry-type "Point", desired projection. This results in a Point-Layer with the same features and attributes as the csv but still without valid geometries.
>
>Step 3: Update the empty geometries with valid points. Sadly there is a lack in QGis, edit existing geometries => OK, creating new features with geometries => OK,  update geometries in geometry-less features => not supported out-of-the-box.
>
Actually QGIS supports this with the "Add part" tool from the Advanced digitizing toolbar. Just select feature in table and digitize. Worth reading <https://docs.qgis.org/3.34/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html#add-part>

Regards,
Harrissou

>So I (not Anthropic Claude 😉) wrote a script, attached as python file.
>
>Operating instructions:
>
>1: Load script into python console
>
>2: activate the exported vector-layer from step 2
>
>3. run the script
>
>4. open attribute-table
>
>5. select the desired feature in table
>
>6. digitize the point-geometry for the selected feature by click on map
>
>7. repeat steps 5 and 6 as often as you like
>
>8. stop and save edits
>
>Afterwards the features have valid geometries and can be edited with QGis on-board tools
>
>Note:
>
>The script does not write coordinates to the attribute-table but creates point-geometries. You can afterwards extract x- and y-coordinates into according fields by QGis-Field-Calculator.
>
>hth
>
>Ludwig
>
>Am 02.12.24 um 14:08 schrieb Pat Brown via QGIS-User:
>> Hi
>>   I have a csv file with data about various mines. It includes descriptions of locality  but no coordinates. I have added this file to qgis and created a shapefile. I now want to add the coordinates of each mine by searching for its locality on a basemap in qgis then clicking on the map to add the coordinates to the shapefile attribute table.  Is this possible or do I have to search for each location on Google Earth, for example, then write out the coordinates and add them to the attribute table manually?
>> 
>> Thanks
>> 
>> Paddy
>> 
>> _______________________________________________
>> 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


More information about the QGIS-User mailing list