Hi everyone,
I am generating a workflow for object-based image classification of drone imagery and am getting tripped up when utilizing vectors for training data. I have “.shp” files for each class created in another software and am trying to join them to create one vector file with an ID column corresponding to the class. I have been trying to use the command v.patch, which does join them, but doesn’t seem to allow for maintaining information about the class. Does anyone have any recommendations to do this? Any help would be greatly appreciated. Ive attached two example “.shp” files for reference.
Best,
Daniel
(attachments)
Shape Files.zip (3.34 KB)
Hi Daniel,
Which is the exact command you are using? There’s the -e flag to copy also attributes [1]. Are you using it?
HTH,
Vero
[1] https://grass.osgeo.org/grass80/manuals/v.patch.html
El jue, 17 feb 2022 a las 23:01, Daniel Jeffrey Kozar via grass-user (<grass-user@lists.osgeo.org>) escribió:
Hi everyone,
I am generating a workflow for object-based image classification of drone imagery and am getting tripped up when utilizing vectors for training data. I have “.shp” files for each class created in another software and am trying to join them to create one vector file with an ID column corresponding to the class. I have been trying to use the command v.patch, which does join them, but doesn’t seem to allow for maintaining information about the class. Does anyone have any recommendations to do this? Any help would be greatly appreciated. Ive attached two example “.shp” files for reference.
Best,
Daniel
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
You do not have any ID column for each class in the original shapefiles, so there is no information to maintain. You should add an ID column, and edit this column such that it contains either text or a number to indicate the class. (There’s no need for two separate shapefiles: just one with a column containing the ID.)
You can do this either in the other software, or directly in GRASS.
If you want to accomplish this in GRASS with the existing point layers, then:
- Add a column for the class_id to both using:
- v.db.addcolumn column=“class_id INTEGER”
- v.db.addcolumn column=“class_id INTEGER”
- Update this column for both:
- v.db.update column=“class_id” value=0 # for the bare
- v.db.update column=class_id value=1 # for the woody points1. Now merge:
- v.patch -e input=“woody,bare” output=training
···
On 18/02/2022 00:00, Daniel Jeffrey Kozar via grass-user wrote:
Hi everyone,
I am generating a workflow for object-based image classification of drone imagery and am getting tripped up when utilizing vectors for training data. I have “.shp” files for each class created in another software and am trying to join them to create one vector file with an ID column corresponding to the class. I have been trying to use the command v.patch, which does join them, but doesn’t seem to allow for maintaining information about the class. Does anyone have any recommendations to do this? Any help would be greatly appreciated. Ive attached two example “.shp” files for reference.
Best,
Daniel
_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)
--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918