<div dir="ltr">Hi all,<div><br></div><div>Upgrading to Fiona 1.8.0 won't help the code below because every outfile.write() call entails a transaction of size 1. The user needs to pass a sequence or iterator of many records to outfile.writerecords() if they want to benefit from larger transactions.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 1, 2018 at 3:46 AM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You are perhaps using a too old version of Fiona. Recent versions insert <br>
features within OGR transactions. Should be fine with latest Fiona 1.8.0<br>
See <a href="https://github.com/Toblerity/Fiona/issues/476" rel="noreferrer" target="_blank">https://github.com/Toblerity/Fiona/issues/476</a><br>
<br>
> Hi, following is the code I used:<br>
> <br>
> Import os, osmium, fiona<br>
> <br>
> fi = 'europe-latest.osm.pbf'<br>
> fo = 'europe-latest.dpkg'<br>
> <br>
> drv = 'DPKG'<br>
> <br>
> crs = {'no_defs': True, 'ellps': 'WGS84', 'datum': 'WGS84', 'proj':<br>
> 'longlat'}<br>
> <br>
> schema = {'geometry': 'LineString',<br>
> 'properties': {'id': 'float', 'name' : 'str', 'kind' :<br>
> 'str'}}<br>
> <br>
> outfile = fiona.open(fo, 'w', driver=drv, crs=crs, schema=schema)<br>
> <br>
> geomfab = osmium.geom.GeoJSONFactory()<br>
> <br>
> class ShapeConverter(osmium.SimpleHandler):<br>
> def way(self, w):<br>
> if 'place' in w.tags:<br>
> rec = {'geometry' : eval(geomfab.create_linestring(w)),<br>
> 'properties' : {'id' : float(<a href="http://w.id" rel="noreferrer" target="_blank">w.id</a>),<br>
> 'name' : w.tags.get('name'),<br>
> 'kind' : w.tags['place']}}<br>
> outfile.write(rec)<br>
> <br>
> ShapeConverter().apply_file(fi, locations=True)<br>
> <br>
> On Thu, Nov 1, 2018 at 4:10 PM jratike80 <<br>
> <br>
> <a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>> wrote:<br>
> > koji higuchi wrote<br>
> > <br>
> > > Hi<br>
> > > I am extracting .osm.pbf file into .gpkg; but the writing rate is very<br>
> > > slow.<br>
> > > When I write into .shp, rate is faster but its limit is 4gb.<br>
> > > So, what other format is better for larger than 4gb requirement?<br>
> > > Thanks for your ideas.<br>
> > > Koji<br>
> > <br>
> > Hi,<br>
> > <br>
> > Show the exact command that you are using so we can see if it could be<br>
> > made<br>
> > faster. For example if you happen to use -skipfailures for handling the<br>
> > invalid geometries of the OSM data then you will make GDAL to do a new<br>
> > transaction for each row and that certainly is slow. But let's have a look<br>
> > at your command first.<br>
> > <br>
> > -Jukka Rahkonen-<br>
> > <br>
> > <br>
> > <br>
> > --<br>
> > Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>
> > _______________________________________________<br>
> > gdal-dev mailing list<br>
> > <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
> > <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sean Gillies</div></div></div>