<div dir="ltr">Hi,<div>It appears I have to do some homework on ogr's shapefile functions as it stands now.</div><div><br></div><div>8GB: If interoperability is more of a priority than capacity, that's a valid consideration. I've not really needed anything > 4GB so far.</div>
<div><br></div><div>Delete:</div><div>By delete I mean leaving the information in the file but (shapefile) taking it out of the index chain (.shx), and .dbf, marking the record with an asterisk in its firs byte.</div><div>
As far as arcgis, I did a delete in this way and tried to load it. When I do not reduce the record count in the dbf header, arcgis will not load it; when I do reduce the record count in the header, arcgis will load the shapefile but the attributes will not match the shapes. As a cross-check, you can open the .dbf in open office or excel: the delete will be recognized.</div>
<div> </div><div>My guess is that arcgis maps the shaperecords to the physical records of the dbf only.</div><div><br></div><div>To allow use of the shapefile in arcgis,  I have to compact the .dbf. The shape will then be handled correctly.</div>
<div><br></div><div>A recipe to try this out:</div><div>create a new empty point shapefile, load it in arcgis. Using arccatalog to create the shapefile, it will have a single ID integer attribute. That's the starting point.</div>
<div>Create 3 points and give them ID's 1 - 3.</div><div>Now to 'delete' the second record using a diskeditor:</div><div>Copy the shapefile. Open the .shx. The .shx has a header and records consisting of offset-length pairs. A pair takes 8 bytes. Change the 2nd offset to be identical to the last (00000040 -> 0000004E). Diminish the filelength indicator in the header (offset 0x18) by 4 (0000003E to 0000003A). Copy the file, except the last 8 bytes to the new .shx file.</div>
<div>DBF: open in editor, change the first byte of the second record (at offset 0x48) to an asterisk. The recordcount in the header is at offset 4 (little endian).</div><div><br></div><div>Load in arcgis, will fail.</div>
<div>Change  the dbf-recordcount to 2, load and open the attribute table. The file will load. The ID's shown will be 1 and 2. The latter should have been 3.</div><div>Conclusion: shape deletes are possible, .dbf not. Compacting the .dbf will, of course, repair things.</div>
<div><br></div><div>Best regards,</div><div>Jan</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 28, 2014 at 11:48 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le lundi 28 avril 2014 23:39:34, Jan Heckman a écrit :<br>
<div class="">> Hi,<br>
><br>
> I've used and maintained an offshoot shapefile library (thanks, Frank), and<br>
> added bits of functionality when needed. There are two that I think might<br>
> be of wider interest.<br>
><br>
> 1) possibility to have shapefiles up to 8 GB (instead of 4 GB in ogr or 2<br>
> GB elsewhere);<br>
<br>
</div>I'm +/- 0 on this, since it might cause interoperabily issues. Actually I've<br>
added a creation option in GDAL 1.11 to avoid crossing the 2GB barrier.<br>
<div class=""><br>
> 2) implementing deletes.<br>
> ad 1) this requires little more than replacing fseek() by _fseeki64() on a<br>
> windows box and using the fact that size indicators are about words rather<br>
> than bytes.<br>
> The use of this feature is limited to library use; afaik gis programs (at<br>
> least arcgis) will not be able to use such an extended shapefile.<br>
> Next, portability might be an issue.<br>
> ad 2) a quick delete without closing and rewriting the .shp and /or the<br>
> .dbf file can obviously be useful. Shapefile as well as dBase III files<br>
> offer handles to do this.<br>
<br>
</div>Not sure to understand what you call by delete here. Is it auto-compaction of<br>
files when deleting a record ? something like DeleteFeature() + REPACK in the<br>
shapefile driver ?<br>
<div class=""><br>
> Issues:<br>
> Arcgis wil not recognize .dbf with records marked for deletion (by starting<br>
> a record with an asterix instead of a space character);<br>
> the (ogr) dbase driver will equally disregard deleted records.<br>
> Result: at the end of the session using the shapefile library, the<br>
> shapefile can be handled without a major file-rewrite, but the .dbf needs<br>
> to have the deleted records removed 'physically'. Still, this can be done<br>
> relatively quickly when closing the file.<br>
<br>
</div>Hum, shapelib already supports deleting dbf record and the ogr shapefile driver<br>
does honour that. So, you are saying that ArcGIS doesn't handle that properly<br>
<div class="HOEnZb"><div class="h5">?<br>
<br>
> Portability might again be an issue.<br>
><br>
> So,does anyone need these features, and is it useful to start a discussion<br>
> how to implement either of these enhancements?<br>
><br>
> regards,<br>
> Jan<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Geospatial professional services<br>
<a href="http://even.rouault.free.fr/services.html" target="_blank">http://even.rouault.free.fr/services.html</a><br>
</font></span></blockquote></div><br></div>