Add point to vector map at given position

From GRASS-Wiki
Jump to navigation Jump to search

Q: How to add a new point to the vector map at given position?

A:

CLI

Method 1

  • Add new point to the vector map (x=100, y=100, layer=1, category=1) with v.edit:
v.edit -n map=<map> tool=add input=- << EOF
P 1 1
100 100
1 1
EOF
  • Insert new record to the attribute table of the vector map (if required) with db.execute:
echo "insert into <map> values(1, ...)" | db.execute input=-

Method 2

v.in.ascii the new point into its own new map, then use v.patch to combine the new point with the old points (attribute tables must match exactly).

   echo "100 100" | v.in.ascii input=- output=new_point_map
   v.patch input=old_point_map,new_point_map output=combined_points_map

wxGUI

Add point to vector map at given position using wxGUI