<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif">
<div style="white-space:normal">
<p dir="auto">The following partial script may be helpful (having the source map in shape format):</p>
<h1 style="font-size:1.4em">assume folder in home directory containing source map - in this case contours.shp</h1>
<h1 style="font-size:1.4em">v_w,v_s,v_e,v_n are string variables with destination region</h1>
<h1 style="font-size:1.4em">the commands create a subset defined by the destination region: contours.shp</h1>
<h1 style="font-size:1.4em">note that the identical naming of input and output is perhaps confusing but harmless</h1>
<h1 style="font-size:1.4em">as long as the home directory does not contain files named contours.*</h1>
<h1 style="font-size:1.4em">—</h1>
<h1 style="font-size:1.4em">importing required modules</h1>
<p dir="auto">import os<br>
import sys<br>
import subprocess<br>
from array import array<br>
import string<br>
import math<br>
from grass.script import core as grass<br>
from grass.script import db as grass</p>
<h1 style="font-size:1.4em">excerpt</h1>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">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')
</code></pre>
<p dir="auto">Jon</p>
<p dir="auto">On 31 Oct 2018, at 10:12, Frank David wrote:</p>
</div>
<div style="white-space:normal">
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">Hello,<br>
<br>
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).<br>
Thank you for your advice !<br>
<br>
Frank<br>
_______________________________________________<br>
grass-user mailing list<br>
grass-user@lists.osgeo.org<br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" style="color:#777">https://lists.osgeo.org/mailman/listinfo/grass-user</a></p>
</blockquote>
</div>
<div style="white-space:normal"></div>
</div>
</body>
</html>