[GRASS-user] GRASS7.2: v.in.osm add-on / Windows 8

Hi GRASS-User list,

I'm currently using GRASS7.2 on Windows 8.

The v.in.osm add-on (https://grass.osgeo.org/grass72/manuals/addons/v.in.osm.html) refuses to work in this setting. I would be grateful for any ideas how to overcome this.

Reference example from the man-page:
v.in.osm input=saarland-latest.osm.pbf table=lines type=point,line output=roads \
         where="highway is not null"

Unfortunately this does not work for me:
v.in.osm input=c:\\hessen-latest.osm.pbf table=lines type=point,line output=test_00 where="highway is not null"
- prints multiple warning that column widths for the attributes osm_id,name, barrier, highway,ref,address, is_in,place,man_made,other_tags will be truncated to 255 characters
- terminates with "WARNING: No data base element files found"

The pbf itself seems to be valid, the "-l" flag lists the tables as points,lines,multilinestrings,multipolygons and other_relations.

Any advice would be much appreciated!
Peter

<peter.loewe@gmx.de>

&quot;Peter Löwe&quot; wrote

Hi GRASS-User list,

I'm currently using GRASS7.2 on Windows 8.

The v.in.osm add-on
(https://grass.osgeo.org/grass72/manuals/addons/v.in.osm.html) refuses to
work in this setting. I would be grateful for any ideas how to overcome
this.

Reference example from the man-page:
v.in.osm input=saarland-latest.osm.pbf table=lines type=point,line
output=roads \
         where="highway is not null"

Unfortunately this does not work for me:
v.in.osm input=c:\\hessen-latest.osm.pbf table=lines type=point,line
output=test_00 where="highway is not null"
- prints multiple warning that column widths for the attributes
osm_id,name, barrier, highway,ref,address, is_in,place,man_made,other_tags
will be truncated to 255 characters
- terminates with "WARNING: No data base element files found"

The pbf itself seems to be valid, the "-l" flag lists the tables as
points,lines,multilinestrings,multipolygons and other_relations.

Any advice would be much appreciated!
Peter

these warnings:

v.in.osm input=D:\dl\osm\saarland-latest.osm.pbf output=test1
type=point,line table=lines
WARNING: Width for column osm_id set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column name set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column highway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column waterway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column aerialway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column barrier set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column man_made set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column other_tags set to 255 (was not specified by OGR),
some strings may be truncated!

can be ignored, they come from ogr's osm driver.

the other warning/error, more investigation is needed

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS7-2-v-in-osm-add-on-Windows-8-tp5304461p5304467.html
Sent from the Grass - Users mailing list archive at Nabble.com.

&quot;Peter Löwe&quot; wrote

Hi GRASS-User list,

I'm currently using GRASS7.2 on Windows 8.

The v.in.osm add-on
(https://grass.osgeo.org/grass72/manuals/addons/v.in.osm.html) refuses to
work in this setting. I would be grateful for any ideas how to overcome
this.

Reference example from the man-page:
v.in.osm input=saarland-latest.osm.pbf table=lines type=point,line
output=roads \
         where="highway is not null"

Unfortunately this does not work for me:
v.in.osm input=c:\\hessen-latest.osm.pbf table=lines type=point,line
output=test_00 where="highway is not null"
- prints multiple warning that column widths for the attributes
osm_id,name, barrier, highway,ref,address, is_in,place,man_made,other_tags
will be truncated to 255 characters
- terminates with "WARNING: No data base element files found"

The pbf itself seems to be valid, the "-l" flag lists the tables as
points,lines,multilinestrings,multipolygons and other_relations.

a quick closer look into v.in.osm, it's just a wrapper around v.in.ogr

tested:

v.in.ogr input=D:\dl\osm\saarland-latest.osm.pbf layer=lines
output=roadsvingor where=highway is not null
Check if OGR layer <lines> contains polygons...
WARNING: Width for column osm_id set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column name set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column highway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column waterway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column aerialway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column barrier set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column man_made set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column other_tags set to 255 (was not specified by OGR),
some strings may be truncated!
Importing -1 features (OGR layer <lines>)...
-----------------------------------------------------
Building topology for vector map <roadsvingor@osm>...
Registering primitives...
104808 primitives registered
781261 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 143707
Number of primitives: 104808
Number of points: 0
Number of lines: 104808
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

just imported all lines where there is an entry in the "highway" column for
me.

it's what in
https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.in.osm/v.in.osm.py#L117

117 grass.run_command('v.in.ogr',
118 quiet=True,
119 input=options['input'],
120 output=self.getNewTmp('ogr'),
121 layer=options['table'],
122 where=options['where'],
123 type=options['type'],
124 flags=flags['o']
125 )

if you do ogrinfo -al -so saarland-latest.osm.pbf, you see the structure of
the osm.pbf file:

e.g.

Layer name: lines
Geometry: Line String
Feature Count: -1
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
osm_id: String (0.0)
name: String (0.0)
highway: String (0.0)
waterway: String (0.0)
aerialway: String (0.0)
barrier: String (0.0)
man_made: String (0.0)
z_order: Integer (0.0)
other_tags: String (0.0)

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS7-2-v-in-osm-add-on-Windows-8-tp5304461p5304471.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

just imported all lines where there is an entry in the "highway" column
for me.

it's what in
https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.in.osm/v.in.osm.py#L117

117 grass.run_command('v.in.ogr',
118 quiet=True,
119 input=options['input'],
120 output=self.getNewTmp('ogr'),
121 layer=options['table'],
122 where=options['where'],
123 type=options['type'],
124 flags=flags['o']
125 )

and when i mimic the manual example by choosing points and lines layer:

v.in.osm input=saarland-latest.osm.pbf table=lines type=point,line
output=roads \
         where="highway is not null"

by

v.in.ogr input=D:\dl\osm\saarland-latest.osm.pbf layer=lines,points
output=roadsvingor where=highway is not null
WARNING: The 'where' option is applied only to the first OGR layer
Check if OGR layer <lines> contains polygons...
Check if OGR layer <points> contains polygons...
WARNING: Width for column osm_id set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column name set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column highway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column waterway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column aerialway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column barrier set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column man_made set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column other_tags set to 255 (was not specified by OGR),
some strings may be truncated!
Importing -1 features (OGR layer <lines>)...
WARNING: Width for column osm_id set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column name set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column barrier set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column highway set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column ref set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column address set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column is_in set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column place set to 255 (was not specified by OGR), some
strings may be truncated!
WARNING: Width for column man_made set to 255 (was not specified by OGR),
some strings may be truncated!
WARNING: Width for column other_tags set to 255 (was not specified by OGR),
some strings may be truncated!
Importing -1 features (OGR layer <points>)...
-----------------------------------------------------
Building topology for vector map <roadsvingor@osm>...
Registering primitives...
167878 primitives registered
844331 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 143707
Number of primitives: 167878
Number of points: 63070
Number of lines: 104808
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

it imports lines in layer1 and points in layer2; although in layer 2 it
claims that there is an inconsistent number of columns in the layer 2's
table.

anyone any idea why v.in.osm doesn't work?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS7-2-v-in-osm-add-on-Windows-8-tp5304461p5304475.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

anyone any idea why v.in.osm doesn't work?

by debug=3 on, it seems to stop around

https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.in.osm/v.in.osm.py#L140

140 try:
141 grass.debug('Step 3/3: v.build.polylines...', 2)
142 grass.run_command('v.build.polylines',
143 quiet=True,
144 input=self.getNewTmp('split'),
145 output=options['output'],
146 cats='same'
147 )

[...]
D:\grassdata\loc_osm\osm\.tmp/unknown\5108.0
D2/3: G_tempfile_pid():
D:\grassdata\loc_osm\osm\.tmp/unknown\5108.0
D3/3: rename 'D:\grassdata\loc_osm\osm\vector/split_10160'
to 'D:\grassdata\loc_osm\osm\.tmp/unknown\5108.0'
D3/3: remove directory
'D:\grassdata\loc_osm\osm\.tmp/unknown\5108.0'
D1/3: grass.script.core.start_command(): g.remove --q -f
type=vector name=split_10160
D1/3: G_set_program_name(): g.remove
D2/3: G_file_name(): path = D:\grassdata\loc_osm\osm
D2/3: G_file_name(): path = D:\grassdata\loc_osm\osm\vector
WARNING: No data base element files found

debug.log attached debug_log.txt
<http://osgeo-org.1560.x6.nabble.com/file/n5304481/debug_log.txt&gt;

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS7-2-v-in-osm-add-on-Windows-8-tp5304461p5304481.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

Helmut Kudrnovsky wrote

anyone any idea why v.in.osm doesn't work?

by debug=3 on, it seems to stop around

https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.in.osm/v.in.osm.py#L140

no, it's around here

70 def cleanup(self):
71
72 for tmp in self.tmp_vects:
73 grass.run_command('g.remove', flags = 'f', type = 'vector',
74 name = tmp, quiet = True)
75

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS7-2-v-in-osm-add-on-Windows-8-tp5304461p5304485.html
Sent from the Grass - Users mailing list archive at Nabble.com.