[GRASS-dev] v.in.osm
Luca Delucchi
lucadeluge at gmail.com
Thu Feb 9 01:20:15 PST 2017
Hi,
I did a change in v.in.osm adding a c flag to cleanup the data and
create a GRASS GIS network topological correct, this is done by
default now. I attached a diff.
The flag could be also the opposite, so don't cleanup the data.
What do you think?
--
ciao
Luca
www.lucadelu.org
-------------- next part --------------
Index: grass7/vector/v.in.osm/v.in.osm.py
===================================================================
--- grass7/vector/v.in.osm/v.in.osm.py (revision 70510)
+++ grass7/vector/v.in.osm/v.in.osm.py (working copy)
@@ -49,6 +49,12 @@
#%end
#%flag
+#% key: c
+#% label: Cleanup data
+#% description: Execute v.split and v.build.polylines to create a GRASS GIS network topological correct
+#%end
+
+#%flag
#% key: l
#% label: List available OGR layers in data source and exit
#%end
@@ -126,28 +132,29 @@
except CalledModuleError:
grass.fatal(_('%s failed') % 'v.in.ogr')
- try:
+
+ if flags['c']:
grass.debug('Step 2/3: v.split...', 2)
- grass.run_command('v.split',
- quiet=True,
- input=self.getTmp('ogr'),
- output=self.getNewTmp('split'),
- vertices=2
- )
- except CalledModuleError:
- grass.fatal(_('%s failed') % 'v.split')
+ try:
+ grass.run_command('v.split',
+ quiet=True,
+ input=self.getTmp('ogr'),
+ output=self.getNewTmp('split'),
+ vertices=2
+ )
+ except CalledModuleError:
+ grass.fatal(_('%s failed') % 'v.split')
+ try:
+ grass.debug('Step 3/3: v.build.polylines...', 2)
+ grass.run_command('v.build.polylines',
+ quiet=True, overwrite=grass.overwrite(),
+ input=self.getNewTmp('split'),
+ output=options['output'],
+ cats='same'
+ )
+ except CalledModuleError:
+ grass.fatal(_('%s failed') % 'v.build.polylines')
- try:
- grass.debug('Step 3/3: v.build.polylines...', 2)
- grass.run_command('v.build.polylines',
- quiet=True,
- input=self.getNewTmp('split'),
- output=options['output'],
- cats='same'
- )
- except CalledModuleError:
- grass.fatal(_('%s failed') % 'v.build.polylines')
-
if __name__ == "__main__":
options, flags = grass.parser()
More information about the grass-dev
mailing list