<div dir="ltr">Darren,<div><br></div><div>These limitations are a result of the shapefile reader/writer implementation. While the specification permits up to 8GB, the implementation might not use it fully.</div><div><br></div>
<div>According to the specification a feature offset is stored as a 32-bit integer to a 16-bit word. So, that's (2^32)*16 bits or (2^32)*2 bytes. To fully utilize this, we need to use unsigned 32-bit integers and check for overflows.</div>
<div>Originally, the shapelib library used by GDAL had the same limit as ESRI's.<br></div><div><br></div><div>If you are reaching the file size limits, I suggest you look into some other file format to store your data. SQLite/SpatiaLite is a good option.</div>
<div><br></div><div>A hacky way to split the features across multiple shapefiles is to use the -where option in ogr2ogr. You can filter based on the FID values.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Nov 25, 2013 at 4:12 PM, CARMAN, Darren <span dir="ltr"><<a href="mailto:Darren.Carman@astrium.eads.net" target="_blank">Darren.Carman@astrium.eads.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:12.0pt">Hi List<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal">
<span style="font-size:12.0pt">I notice on the OGR formats page for ESRI Shapefile the following is mentioned:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">================<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Size Issues<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Geometry: The Shapefile format explicitly uses 32bit offsets and so cannot go over 8GB (it actually uses 32bit offsets to 16bit words). Hence, it is is not recommended to use a file size over 4GB.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Attributes: The dbf format does not have any offsets in it, so it can be arbitrarily large.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">================<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Yet on the ESRI website:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">================<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Geometry limitations<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">There is a 2 GB size limit for any shapefile component file, which translates to a maximum of roughly 70 million point features. The actual number of line or polygon features you can store in a shapefile depends on the number of vertices in each line or polygon (a vertex is equivalent to a point).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">================<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">I assume the OGR web page is wrong, or has a different meaning outside of ESRI S/W use.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">I notice that the PostGIS utility pgsql2shp stops processing with an error once the dbf file goes over 2GB. Is there any way to get ogr2ogr to do this?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Ideally, something I can’t find a lot of information about online, is there a way to get ogr2ogr to start writing to a new shapefile at a certain processing point (number of objects or file size)?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Alternatively, assuming the OGR website text is correct for files it creates, is there any utility that could be used to split the created shapefile files into ones with a size less than 2GB?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Thanks in advance<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Darren<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u><span style="margin-top:18px;width:10px;min-height:239px"><img width="10" height="239"></span><u></u><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Darren Carman</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#5f5f5f"><br>
Senior Software Engineer<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#5f5f5f">GEO-Information Services<u></u><u></u></span></p><p class="MsoNormal">
<b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#5f5f5f"><u></u> <u></u></span></b></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Astrium Services</span></b><b><span lang="DE" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u><u></u></span></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#5f5f5f">Tel <a href="tel:%2B44%20%280%291252%20362138" value="+441252362138" target="_blank">+44 (0)1252 362138</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#5f5f5f"><a href="http://www.infoterra.co.uk" target="_blank"><span style="color:blue">http://www.astrium-geo.com</span></a><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p></div>
<p> </p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Infoterra Ltd. </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Is part of the Astrium GEO-Information Services Division and a wholly owned subsidiary of Astrium, Europe's leading space systems and services specialist.<br>

<br>
</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Disclaimer. </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#666666">The information contained in this e-mail and its attachments are
confidential and intended only for the use of the named addressee(s). If you
are not the intended addressee, please do not read, copy, use or disclose this
message or its attachments. If you have received this message in error, please
notify the sender immediately and delete or destroy all copies of this message
and attachments in all media. Any views or opinions expressed are solely those
of the author and do not necessarily represent those of Infoterra Ltd and shall
not form part of any binding agreement.<br>
<br>
Infoterra Limited a company registered in <u></u><u></u>England<u></u><u></u> under number 2359955 and
having its registered office at Europa House, <u></u><u></u>Southwood Crescent<u></u>, <u></u>Farnborough<u></u>,
 <u></u>GU14 0NL<u></u><u></u>. VAT number
GB 476 0468 27. <br>
<br>
</span><span style="font-size:10.0pt;font-family:Webdings;color:#009900">P </span><span style="font-size:7.5pt;font-family:"Tahoma","sans-serif";color:#009900">Before
printing, think about the environment </span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<br></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E
</div>