The objective is to become familiar with the content of both USGS DLG files and shapefiles, and to consider the strengths of the former and limits of the latter.
The assignment is to transcribe data (just three line records) from a DLG file to .shp file format, manually, and then answer a few questions about what could be in the .shp file.
The USGS Digital Line Graph (DLG) format is documented online here , but for this exercise consider just these three excerpted "line" records:
. . . L 2 5 2 2 6 2 0 0 532812.91 4233413.06 532773.94 4247282.79 L 3 2 6 1 2 2 0 0 532757.10 4247282.79 539496.77 4247314.04 L 4 6 7 1 5 2 0 0 539496.77 4247314.04 542795.89 4247330.85 . . .Each line record starts with an "L" which is followed by eight numbers:
ESRI's Shapefiles are documented in an ESRI white paper, ESRI Shapefile Technical Description which you should examine. Perhaps even study.
Once you have your head wrapped around what is in a shapefile .shp file, fill-in this table with the contents for the .shp file (like the example below) that would represent the three lines above; indicating what content should be in each byte position in the file. I.e., lay-out the content for the file header, and for the the three record header - record content pairs, like this, (but with the right numbers):
|0 - 3||9994||integer|
|4 - 23||0||integer|
|24 - 27||length||integer|
|28 - 31||1000||integer|
|etc||See table 1.||p. 4 white paper|
|96 - 99||0||integer|
|100 - 103||1 Why? See Table 2.||integer|
|104 - 107||content length||integer|
|...||See Table 6.||p. 8 white paper|
|(n-16) - (n-8)||x-coord||as double|
|(n-8) - (n)||y-coord||as double|
(Here's an aside that most of you should ignore, but if all of this does not have you thoroughly confused already and you've noted that we are ignoring the switching between little endian and big endian order that ESRI sprinkled in this format, you might want to ponder why anyone would do that.)
Answer these questions...
Basic structure of a .shp file:
Files are sequences of bytes taken and interpreted in groups.
Shapefiles (.shp) use two digital representations of numbers:
The value for the file length in the file header is the total length of the file, including the header, counted in 16-bit words.
The content length in each record header excludes the eight bytes of the record header, so it is just the length of the content part of the record, specified as the count of 16-bit words.
Polygons close with the first point explicitly repeated as the last. That is, a triangle shape will have four points in its array.
ESRI. 1995. ArcView Shapefile Technical Description Available as part of ESRI's "ArcView White Paper Series" on line at www.esri.com.
ESRI. 1998. Shapefile Technical Description Available as part of ESRI's "ArcView White Paper Series" on line at www.esri.com.
USGS. 1984. USGS Digital Cartographic Data Standards: Digital Line Graphs from 1:24,000-scale Maps, US Geological Survey Circular 895-C.