Proceed to GeoCommunity Home Page


SpatialNewsGIS Data DepotGeoImaging ChannelGIS and MappingSoftwareGIS JobsGeoBids-RFPsGeoCommunity MarketplaceGIS Event Listings
HomeLoginAccountsAboutContactAdvertiseSearchFAQsForumsCartFree Newsletter

Sponsored by:


TOPICS
Today's News

Submit News

Feature Articles

Product Reviews

Education

News Affiliates

Discussions

Newsletters

Email Lists

Polls

Editor's Corner


SpatialNews Daily Newswire!
Subscribe now!

Latest Industry Headlines
SiteVision GIS Partnership With City of Roanoke VA Goes Live
Garmin® Introduces Delta™ Upland Remote Trainer with Beeper
Caliper Offers Updated Chile Data for Use with Maptitude 2013
Southampton’s Go! Rhinos Trail Mapped by Ordnance Survey
New Approach to Measuring Coral Growth Offers Valuable Tool for Reef Managers
Topo ly - Tailor-Fit for Companies' Online Mapping Needs

Latest GeoBids-RFPs
Nautical Charts*Poland
Software & Telemetry GPS
Spatial Data Management-DC
Geospatial and Mapping-DC
Next-Gen 911-MO

Recent Job Opportunities
Planner/GIS Specialist
Team Leader- Grape Supply Systems
Geospatial Developer

Recent Discussions
Raster images
cartographic symbology
Telephone Exchange areas in Europe
Problem showcasing Vector map on Windows CE device
Base map

GeoCommunity Mailing List
 
Mailing List Archives

Subject: Re: [gislist] Quick help
Date:  08/12/2004 10:55:03 AM
From:  Quantitative Decisions



At 08:47 AM 8/12/2004 -0600, Brian Keith wrote:
>It [method of shapefile repair posted 10 Aug 2004] seems like a good
>solution, but how do know how many features were in the original shp file?

Good question. There are many ways to find the number of features in the
original of a corrupted shapefile, including:

(1) You remember the count that was displayed when the attribute table
was last open in your GIS software. (This happens more frequently than you
might believe: good GIS users are constantly aware of the information their
software provides them.)

(2) If the shx file is not corrupted, its size tells you. If the size
is 'N' bytes, then there should be (N-100)/8 features. For example,
states.shx in the /ESRI/EsriData/USA folder is 508 bytes, representing
(508-100)/8 = 51 features (50 states plus DC).

(3) Even if the shx file is corrupted, the file length at byte offset
24 (stored as a big-endian 32-bit integer) tells you the intended value of
'N'. This length is in 16-bit words, so double it to get the number of
bytes. For example, opening states.shx in the Windows/DOS debug utility
and issuing a 'd' (display) command gives the following lines:

xxxx:0100 00 00 27 0A 00 00 00 00-00 00 00 00 00 00 00
00 ..'.............
xxxx:0110 00 00 00 00 00 00 00 00-00 00 00 FE E8 03 00
00 ................

(I have replaced the base segment address with "xxxx" because it is
variable but irrelevant.) Offset 24 begins after the dash in the second
line: the four bytes there are 00 00 00 FE, the hexadecimal representation
of 15 (F) * 16 + 14 (E) = 254, implying 508 bytes or (again) 51 features.

(4) You have a backup copy and know that the most current copy was
created by adding and/or removing a known number of features.

(5) You can closely guess the correct number, so you attempt the file
repair using the (quick and simple) method I described, repeating it with a
different number of features if it fails to work. Often a good guess is
one more record than is apparent in the dBase table, because shapefile
corruption frequently happens when one is editing a record and it alone
gets screwed up.

(6) There have to be a certain number of features. For instance, just
knowing the contents of states.shp tells you there should be 50 or 51
features in it.

--Bill Huber
Quantitative Decisions

_______________________________________________
gislist mailing list
gislist@lists.geocomm.com
http://lists.geocomm.com/mailman/listinfo/gislist

_________________________________
This list is brought to you by
The GeoCommunity
http://www.geocomm.com/

Get Access to the latest GIS & Geospatial Industry RFPs and bids
http://www.geobids.com

Sponsored by:

For information
regarding
advertising rates
Click Here!

Copyright© 1995-2012 MindSites Group / Privacy Policy

GeoCommunity™, Wireless Developer Network™, GIS Data Depot®, and Spatial News™
including all logos and other service marks
are registered trademarks and trade communities of
MindSites Group