/* Dump out the ascii format DEM file */
void rawDumpAsciiDEM( fgRAWDEM *raw ) {
+ char outfile[256];
+ /* Generate output file name */
+
+
+ /* Dump the "A" record */
+
+ /* get the name field (144 characters) */
+ for ( i = 0; i < 144; i++ ) {
+ name[i] = fgetc(fd);
+ }
+ name[i+1] = '\0';
+
+ /* clean off the whitespace at the end */
+ for ( i = strlen(name)-2; i > 0; i-- ) {
+ if ( !isspace(name[i]) ) {
+ i=0;
+ } else {
+ name[i] = '\0';
+ }
+ }
+ printf(" Quad name field: %s\n", name);
+
+ /* get quadrangle id (now part of previous section */
+ /* next_token(fd, dem_quadrangle); */
+ /* printf(" Quadrangle = %s\n", dem_quadrangle); */
+
+ /* DEM level code, 3 reflects processing by DMA */
+ inum = next_int(fd);
+ printf(" DEM level code = %d\n", inum);
+
+ /* Pattern code, 1 indicates a regular elevation pattern */
+ inum = next_int(fd);
+ printf(" Pattern code = %d\n", inum);
+
+ /* Planimetric reference system code, 0 indicates geographic
+ * coordinate system. */
+ inum = next_int(fd);
+ printf(" Planimetric reference code = %d\n", inum);
+
+ /* Zone code */
+ inum = next_int(fd);
+ printf(" Zone code = %d\n", inum);
+
+ /* Map projection parameters (ignored) */
+ for ( i = 0; i < 15; i++ ) {
+ dnum = next_double(fd);
+ /* printf("%d: %f\n",i,dnum); */
+ }
+
+ /* Units code, 3 represents arc-seconds as the unit of measure for
+ * ground planimetric coordinates throughout the file. */
+ inum = next_int(fd);
+ if ( inum != 3 ) {
+ printf(" Unknown (X,Y) units code = %d!\n", inum);
+ exit(-1);
+ }
+
+ /* Units code; 2 represents meters as the unit of measure for
+ * elevation coordinates throughout the file. */
+ inum = next_int(fd);
+ if ( inum != 2 ) {
+ printf(" Unknown (Z) units code = %d!\n", inum);
+ exit(-1);
+ }
+
+ /* Number (n) of sides in the polygon which defines the coverage of
+ * the DEM file (usually equal to 4). */
+ inum = next_int(fd);
+ if ( inum != 4 ) {
+ printf(" Unknown polygon dimension = %d!\n", inum);
+ exit(-1);
+ }
+
+ /* Ground coordinates of bounding box in arc-seconds */
+ dem_x1 = m->originx = next_exp(fd);
+ dem_y1 = m->originy = next_exp(fd);
+ printf(" Origin = (%.2f,%.2f)\n", m->originx, m->originy);
+
+ dem_x2 = next_exp(fd);
+ dem_y2 = next_exp(fd);
+
+ dem_x3 = next_exp(fd);
+ dem_y3 = next_exp(fd);
+
+ dem_x4 = next_exp(fd);
+ dem_y4 = next_exp(fd);
+
+ /* Minimum/maximum elevations in meters */
+ dem_z1 = next_exp(fd);
+ dem_z2 = next_exp(fd);
+ printf(" Elevation range %.4f %.4f\n", dem_z1, dem_z2);
+
+ /* Counterclockwise angle from the primary axis of ground
+ * planimetric referenced to the primary axis of the DEM local
+ * reference system. */
+ next_token(fd, token);
+
+ /* Accuracy code; 0 indicates that a record of accuracy does not
+ * exist and that no record type C will follow. */
+ /* DEM spacial resolution. Usually (3,3,1) (3,6,1) or (3,9,1)
+ * depending on latitude */
+ /* I will eventually have to do something with this for data at
+ * higher latitudes */
+ next_token(fd, token);
+ printf(" accuracy & spacial resolution string = %s\n", token);
+ i = strlen(token);
+ printf(" length = %d\n", i);
+
+ ptr = token + i - 12;
+ printf(" last field = %s = %.2f\n", ptr, atof(ptr));
+ ptr[0] = '\0';
+
+ ptr = ptr - 12;
+ m->col_step = atof(ptr);
+ printf(" last field = %s = %.2f\n", ptr, m->row_step);
+ ptr[0] = '\0';
+
+ ptr = ptr - 12;
+ m->row_step = atof(ptr);
+ printf(" last field = %s = %.2f\n", ptr, m->col_step);
+ ptr[0] = '\0';
+
+ /* accuracy code = atod(token) */
+ inum = atoi(token);
+ printf(" Accuracy code = %d\n", inum);
+
+ printf(" column step = %.2f row step = %.2f\n",
+ m->col_step, m->row_step);
+ /* dimension of arrays to follow (1)*/
+ next_token(fd, token);
+
+ /* number of profiles */
+ dem_num_profiles = m->cols = m->rows = next_int(fd);
+ printf(" Expecting %d profiles\n", dem_num_profiles);
+
}
/* $Log$
-/* Revision 1.1 1998/03/02 23:31:01 curt
-/* Initial revision.
+/* Revision 1.2 1998/03/03 02:04:01 curt
+/* Starting DEM Ascii format output routine.
/*
+ * Revision 1.1 1998/03/02 23:31:01 curt
+ * Initial revision.
+ *
*/