31 static const char* PROCESS_CODE[]
32 = {
"Autocorrelation resample simple bilinear",
33 "Manual profile GRIDEM simple bilinear",
34 "DLG/hypsography CTOG 8-direction bilinear",
35 "Interpolation from photogrammetic system contours DCASS",
37 "DLG/hypsography LINETRACE, LT4X complex linear",
38 "DLG/hypsography CPS-3, ANUDEM, GRASS complex polynomial",
39 "Electronic imaging (non-photogrammetric), active or passive",
42 static const int MAX_PROCESS_CODE_INDEX = 8;
44 static const char* GROUND_REF_SYSTEM[]
49 static const int MAX_GROUND_REF_SYSTEM_INDEX = 2;
51 static const char* GROUND_REF_SYSTEM_UNITS[]
57 static const int MAX_GROUND_REF_SYSTEM_UNITS_INDEX = 3;
60 static const char* VERTICAL_DATUM[]
61 = {
"local mean sea level",
62 "National Geodetic Vertical Datum 1929",
63 "North American Vertical Datum 1988" };
65 static const int MAX_VERTICAL_DATUM_INDEX = 2;
67 static const char* HORIZONTAL_DATUM[]
68 = {
"North American Datum 1927 (NAD 27)",
69 "World Geoditic System 1972 (WGS 72)",
73 "Puerto Rico Datum" };
75 static const int MAX_HORIZONTAL_DATUM_INDEX = 5;
86 _groundRefSysUnits(0),
89 _counterclockAngle(0.0),
373 return header.
print(s);
379 std::string connectionString = file.
c_str();
381 createIstream(connectionString, std::ios_base::in | std::ios_base::binary);
384 if ( is && is->good() )
386 open( is, connectionString );
400 const std::string& connectionString)
403 if ( result&&str&& str->good() )
406 char* bufstr =
new char[1024];
407 char* temp =
new char[1024];
412 strncpy(temp, bufstr, 40);
416 strncpy(temp,bufstr+40,40);
424 strncpy(temp,bufstr+137,3);
428 strncpy(temp,bufstr+140,4);
440 for (i = 0; i < 4; i++)
465 strncpy(temp, bufstr+884,1);
497 char* bufstr =
new char[1024];
498 char* temp =
new char[1024];
503 strncpy(temp, bufstr, 40);
507 strncpy(temp,bufstr+40,40);
515 strncpy(temp,bufstr+137,3);
519 strncpy(temp,bufstr+140,4);
531 for (i = 0; i < 4; i++)
556 strncpy(temp, bufstr+884,1);
590 std::ios_base::fmtflags f = out.flags();
593 std::string prefix =
"usgs_dem.";
595 out << std::setiosflags(std::ios_base::fixed|std::ios_base::left)
596 << std::setprecision(10)
598 << prefix << std::setw(W)
599 <<
"quadrangle_name:" <<
getQuadName().c_str() <<
"\n" 600 << prefix << std::setw(W)
602 << prefix << std::setw(W)
604 << prefix << std::setw(W)
606 << prefix << std::setw(W)
610 if ( tmpl >= 0 && tmpl <= MAX_PROCESS_CODE_INDEX)
612 out << PROCESS_CODE[tmpl] <<
"\n";
616 out <<
"unknown" <<
"\n";
619 out << prefix << std::setw(W)
621 << prefix << std::setw(W)
623 << prefix << std::setw(W)
625 << prefix << std::setw(W)
627 << prefix << std::setw(W) <<
"ground_ref_sys: ";
630 if ( tmpl >= 0 && tmpl <= MAX_GROUND_REF_SYSTEM_INDEX)
632 out << GROUND_REF_SYSTEM[tmpl] <<
"\n";
639 out << prefix << std::setw(W)
641 << prefix << std::setw(W)
642 <<
"ground_ref_sys_units:";
644 if ( tmpl >= 0 && tmpl <= MAX_GROUND_REF_SYSTEM_UNITS_INDEX)
646 out << GROUND_REF_SYSTEM_UNITS[tmpl] <<
"\n";
653 out << prefix << std::setw(W)
654 <<
"elevation_units: ";
656 if ( tmpl >= 0 && tmpl <= MAX_GROUND_REF_SYSTEM_UNITS_INDEX)
658 out << GROUND_REF_SYSTEM_UNITS[tmpl] <<
"\n";
665 out << prefix << std::setw(W)
667 << prefix << std::setw(W)
669 << prefix << std::setw(W)
671 << prefix << std::setw(W)
673 << prefix << std::setw(W)
675 << prefix << std::setw(W)
677 << prefix << std::setw(W)
679 << prefix << std::setw(W)
681 << prefix << std::setw(W)
683 << prefix << std::setw(W)
685 << prefix << std::setw(W)
687 << prefix << std::setw(W)
689 << prefix << std::setw(W)
690 <<
"vertical_datum:";
693 if ( tmpl >= 0 && tmpl <= MAX_VERTICAL_DATUM_INDEX)
695 out << VERTICAL_DATUM[tmpl] <<
"\n";
702 out << prefix << std::setw(W)
704 << prefix << std::setw(W)
705 <<
"horizontal_datum:";
707 if ( tmpl >= 0 && tmpl <= MAX_HORIZONTAL_DATUM_INDEX)
709 out << HORIZONTAL_DATUM[tmpl] <<
"\n";
717 for (
unsigned int i=0; i < CORNERS.size(); ++i)
719 out << prefix <<
"corner[" << i
720 << std::setw(CW)<<
"].x: " << CORNERS[i].getX() <<
"\n" 721 << prefix <<
"corner[" << i
722 << std::setw(CW)<<
"].y: " << CORNERS[i].getY() <<
"\n" 736 return header.
open(s);
740 const char* prefix)
const 744 if ( (type ==
"unknown") || (datum ==
"unknown") )
776 double convertFactor = 1.0;
777 if ( bIsArcSecs ==
true )
779 convertFactor = 1.0 / 3600;
781 else if ( bIsRadians ==
true )
783 convertFactor = 180.0 /
M_PI;
788 (tieX * convertFactor) );
791 (tieY * convertFactor) );
794 (scaleX * convertFactor) );
797 (scaleY * convertFactor) );
878 type =
"ossimEquDistCylProjection";
881 type =
"ossimUtmProjection";
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
static const char * DATUM_KW
Represents serializable keyword/value map.
static const char * TIE_POINT_LON_KW
static StreamFactoryRegistry * instance()
static const char * METERS_PER_PIXEL_Y_KW
static const char * TYPE_KW
static const char * TIE_POINT_NORTHING_KW
static long getLong(char *const strbuf, long const startpos, long const width)
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * ZONE_KW
static bool isUsgsDem(const ossimFilename &file)
Does basic sanity checks to see if file is a dem.
static const char * TIE_POINT_EASTING_KW
static bool getDouble(std::string const &strbuf, long const startpos, long const width, double &val)
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
std::vector< ossimDemPoint > ossimDemPointVector
std::basic_istream< char > istream
Base class for char input streams.
double usft2mtrs(double feet)
static const char * HEMISPHERE_KW
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
static const char * TIE_POINT_LAT_KW
static bool getRecord(ossim::istream &s, std::string &strbuf, long reclength=1024)
Reads a single record from a DEM.
static const char * METERS_PER_PIXEL_X_KW
std::basic_ostream< char > ostream
Base class for char output streams.