[GRASS-user] partial vector copy to smaller territory

Jón Eiríksson jeir at hi.is
Wed Oct 31 04:35:48 PDT 2018


The following partial script may be helpful (having the source map in shape format):

assume folder in home directory containing source map - in this case contours.shp
v_w,v_s,v_e,v_n are string variables with destination region
the commands create a subset defined by the destination region: contours.shp
note that the identical naming of input and output is perhaps confusing but harmless
as long as the home directory does not contain files named contours.*
—
importing required modules

import os
import sys
import subprocess
from array import array
import string
import math
from grass.script import core as grass
from grass.script import db as grass

excerpt

cmd = 'ogr2ogr -clipsrc' + ' ' + v_w + ' ' + v_s + ' ' + v_e + ' ' + v_n
cmd = cmd + ' ' + '~/contours.shp' + ' ~/folder_name/contours.shp'
subprocess.call(cmd, shell = True)
grass.run_command('v.in.ogr', input='contours.shp', layer='contours', output='contours')


Jon

On 31 Oct 2018, at 10:12, Frank David wrote:

Hello,

What is the best and fast way to make a copy of a part of vector map (national) to get a smaller territory ? (partial copy).
Thank you for your advice !

Frank
_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181031/6d9a2fa1/attachment.html>


More information about the grass-user mailing list