This commit is contained in:
dfriedrich 2019-05-23 21:08:09 -04:00
commit bfaaa91639
17 changed files with 15912 additions and 0 deletions

BIN
bin/libshp.dll Normal file

Binary file not shown.

BIN
bin/shp_2_txt.exe Normal file

Binary file not shown.

1
compile.bat Normal file
View file

@ -0,0 +1 @@
g++ -g -Wall -I./src/cpp ./src/cpp/shp_2_txt.cpp -static -L ./src/cpp -l shp.dll -o ./bin/shp_2_txt

2
run_testing.bat Normal file
View file

@ -0,0 +1,2 @@
set rootFolder=%~dp0
%rootFolder%\bin\shp_2_txt.exe -i %rootFolder%\testing\MA.dbf -o %rootFolder%\testing\MA.txt

95
shp_2_txt.cpp Normal file
View file

@ -0,0 +1,95 @@
/*
http://shapelib.maptools.org/dbf_api.html
basic funtionality taken from dbfdump.c
path to libshp.dll has to be added as a PATH var
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
#include "shapefil.h"
int main(int argc, char const *argv[])
{ string dbf_filename;
string txt_filename;
if (argc == 1)
{
// no arguments given, print help
cout << "No input and output files defined!" << endl;
cout << "example: shp_2_txt -i MA.dbf -o MA.txt" << endl;
return 0;
}
// parse arguments
for (int i = 1; i < argc; i++)
{
if (argv[i][0] == '\0')
{
continue;
}
else if (strcmp(argv[i],"-i") == 0)
{
dbf_filename = argv[i + 1];
}
else if (strcmp(argv[i],"-o") == 0 )
{
txt_filename = argv[i + 1];
}
}
DBFHandle dbfh;
int i, iRecord;
char szTitle[12];
cout << dbf_filename << " " << txt_filename << endl;
// open textfile and dbf handle
ofstream txt_file(txt_filename);
dbfh = DBFOpen(dbf_filename.c_str(), "rb");
// check
if (dbfh <= 0)
{
throw string("File " + dbf_filename + " not found");
}
else
{
// loop over dbf records
for( iRecord = 0; iRecord < DBFGetRecordCount(dbfh); iRecord++ )
{
// loop over fields of record
for( i = 0; i < DBFGetFieldCount(dbfh); i++ )
{
// DBFFieldType eType;
// eType = DBFGetFieldInfo( dbfh, i, szTitle, &nWidth, &nDecimals );
string dec_lat = "DEC_LAT";
string dec_lon = "DEC_LON";
string ellip_h = "ELLIP_HT";
string ortho_h = "ORTHO_HT";
string str(szTitle);
string line;
// parse for lat, lon in degrees and orhto height
if (szTitle == dec_lat or szTitle == dec_lon or szTitle == ortho_h)
{
txt_file << DBFReadStringAttribute( dbfh, iRecord, i );
txt_file << " ";
}
}
txt_file << endl;
}
// close dbf handle and textfile
DBFClose( dbfh );
txt_file.close();
cout << "Done." << endl;
}
return 0;
}

BIN
src/cpp/libshp.dll Normal file

Binary file not shown.

BIN
src/cpp/libshp.dll.a Normal file

Binary file not shown.

755
src/cpp/shapefil.h Normal file
View file

@ -0,0 +1,755 @@
#ifndef SHAPEFILE_H_INCLUDED
#define SHAPEFILE_H_INCLUDED
/******************************************************************************
* $Id: shapefil.h,v 1.56 2018-08-16 15:39:07 erouault Exp $
*
* Project: Shapelib
* Purpose: Primary include file for Shapelib.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
* Copyright (c) 2012-2016, Even Rouault <even dot rouault at mines-paris dot org>
*
* This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see COPYING). This
* option is discussed in more detail in shapelib.html.
*
* --
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*
* $Log: shapefil.h,v $
* Revision 1.56 2018-08-16 15:39:07 erouault
* * shpopen.c, dbfopen.c, shptree.c, sbnsearch.c: resyc with GDAL
* internal shapelib. Mostly to allow building those files as C++
* without warning. Also add FTDate entry in DBFFieldType
* (see https://github.com/OSGeo/gdal/pull/308). And some other
* code cleanups
*
* Revision 1.55 2016-12-05 18:44:08 erouault
* * dbfopen.c, shapefil.h: write DBF end-of-file character 0x1A by default.
* This behaviour can be controlled with the DBFSetWriteEndOfFileChar()
* function.
*
* Revision 1.54 2016-12-05 12:44:05 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.53 2016-12-04 15:30:15 erouault
* * shpopen.c, dbfopen.c, shptree.c, shapefil.h: resync with
* GDAL Shapefile driver. Mostly cleanups. SHPObject and DBFInfo
* structures extended with new members. New functions:
* DBFSetLastModifiedDate, SHPOpenLLEx, SHPRestoreSHX,
* SHPSetFastModeReadObject
*
* * sbnsearch.c: new file to implement original ESRI .sbn spatial
* index reading. (no write support). New functions:
* SBNOpenDiskTree, SBNCloseDiskTree, SBNSearchDiskTree,
* SBNSearchDiskTreeInteger, SBNSearchFreeIds
*
* * Makefile, makefile.vc, CMakeLists.txt, shapelib.def: updates
* with new file and symbols.
*
* * commit: helper script to cvs commit
*
* Revision 1.52 2011-12-11 22:26:46 fwarmerdam
* upgrade .qix access code to use SAHooks (gdal #3365)
*
* Revision 1.51 2011-07-24 05:59:25 fwarmerdam
* minimize use of CPLError in favor of SAHooks.Error()
*
* Revision 1.50 2011-05-13 17:35:17 fwarmerdam
* added DBFReorderFields() and DBFAlterFields() functions (from Even)
*
* Revision 1.49 2011-04-16 14:38:21 fwarmerdam
* avoid warnings with gcc on SHP_CVSID
*
* Revision 1.48 2010-08-27 23:42:52 fwarmerdam
* add SHPAPI_CALL attribute in code
*
* Revision 1.47 2010-01-28 11:34:34 fwarmerdam
* handle the shape file length limits more gracefully (#3236)
*
* Revision 1.46 2008-11-12 14:28:15 fwarmerdam
* DBFCreateField() now works on files with records
*
* Revision 1.45 2008/11/11 17:47:10 fwarmerdam
* added DBFDeleteField() function
*
* Revision 1.44 2008/01/16 20:05:19 bram
* Add file hooks that accept UTF-8 encoded filenames on some platforms. Use SASetupUtf8Hooks
* tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability. Currently, this
* is only available on the Windows platform that decodes the UTF-8 filenames to wide
* character strings and feeds them to _wfopen and _wremove.
*
* Revision 1.43 2008/01/10 16:35:30 fwarmerdam
* avoid _ prefix on #defined symbols (bug 1840)
*
* Revision 1.42 2007/12/18 18:28:14 bram
* - create hook for client specific atof (bugzilla ticket 1615)
* - check for NULL handle before closing cpCPG file, and close after reading.
*
* Revision 1.41 2007/12/15 20:25:32 bram
* dbfopen.c now reads the Code Page information from the DBF file, and exports
* this information as a string through the DBFGetCodePage function. This is
* either the number from the LDID header field ("LDID/<number>") or as the
* content of an accompanying .CPG file. When creating a DBF file, the code can
* be set using DBFCreateEx.
*
* Revision 1.40 2007/12/06 07:00:25 fwarmerdam
* dbfopen now using SAHooks for fileio
*
* Revision 1.39 2007/12/04 20:37:56 fwarmerdam
* preliminary implementation of hooks api for io and errors
*
* Revision 1.38 2007/11/21 22:39:56 fwarmerdam
* close shx file in readonly mode (GDAL #1956)
*
* Revision 1.37 2007/10/27 03:31:14 fwarmerdam
* limit default depth of tree to 12 levels (gdal ticket #1594)
*
* Revision 1.36 2007/09/10 23:33:15 fwarmerdam
* Upstreamed support for visibility flag in SHPAPI_CALL for the needs
* of GDAL (gdal ticket #1810).
*
* Revision 1.35 2007/09/03 19:48:10 fwarmerdam
* move DBFReadAttribute() static dDoubleField into dbfinfo
*
* Revision 1.34 2006/06/17 15:33:32 fwarmerdam
* added pszWorkField - bug 1202 (rso)
*
* Revision 1.33 2006/02/15 01:14:30 fwarmerdam
* added DBFAddNativeFieldType
*
* Revision 1.32 2006/01/26 15:07:32 fwarmerdam
* add bMeasureIsUsed flag from Craig Bruce: Bug 1249
*
* Revision 1.31 2006/01/05 01:27:27 fwarmerdam
* added dbf deletion mark/fetch
*
* Revision 1.30 2005/01/03 22:30:13 fwarmerdam
* added support for saved quadtrees
*
* Revision 1.29 2004/09/26 20:09:35 fwarmerdam
* avoid rcsid warnings
*
* Revision 1.28 2003/12/29 06:02:18 fwarmerdam
* added cpl_error.h option
*
* Revision 1.27 2003/04/21 18:30:37 warmerda
* added header write/update public methods
*
* Revision 1.26 2002/09/29 00:00:08 warmerda
* added FTLogical and logical attribute read/write calls
*
* Revision 1.25 2002/05/07 13:46:30 warmerda
* added DBFWriteAttributeDirectly().
*
* Revision 1.24 2002/04/10 16:59:54 warmerda
* added SHPRewindObject
*
* Revision 1.23 2002/01/15 14:36:07 warmerda
* updated email address
*
* Revision 1.22 2002/01/15 14:32:00 warmerda
* try to improve SHPAPI_CALL docs
*/
#include <stdio.h>
#ifdef USE_DBMALLOC
#include <dbmalloc.h>
#endif
#ifdef USE_CPL
#include "cpl_conv.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************/
/* Configuration options. */
/************************************************************************/
/* -------------------------------------------------------------------- */
/* Should the DBFReadStringAttribute() strip leading and */
/* trailing white space? */
/* -------------------------------------------------------------------- */
#define TRIM_DBF_WHITESPACE
/* -------------------------------------------------------------------- */
/* Should we write measure values to the Multipatch object? */
/* Reportedly ArcView crashes if we do write it, so for now it */
/* is disabled. */
/* -------------------------------------------------------------------- */
#define DISABLE_MULTIPATCH_MEASURE
/* -------------------------------------------------------------------- */
/* SHPAPI_CALL */
/* */
/* The following two macros are present to allow forcing */
/* various calling conventions on the Shapelib API. */
/* */
/* To force __stdcall conventions (needed to call Shapelib */
/* from Visual Basic and/or Dephi I believe) the makefile could */
/* be modified to define: */
/* */
/* /DSHPAPI_CALL=__stdcall */
/* */
/* If it is desired to force export of the Shapelib API without */
/* using the shapelib.def file, use the following definition. */
/* */
/* /DSHAPELIB_DLLEXPORT */
/* */
/* To get both at once it will be necessary to hack this */
/* include file to define: */
/* */
/* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
/* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
/* */
/* The complexity of the situation is partly caused by the */
/* peculiar requirement of Visual C++ that __stdcall appear */
/* after any "*"'s in the return value of a function while the */
/* __declspec(dllexport) must appear before them. */
/* -------------------------------------------------------------------- */
#ifdef SHAPELIB_DLLEXPORT
# define SHPAPI_CALL __declspec(dllexport)
# define SHPAPI_CALL1(x) __declspec(dllexport) x
#endif
#ifndef SHPAPI_CALL
# if defined(USE_GCC_VISIBILITY_FLAG)
# define SHPAPI_CALL __attribute__ ((visibility("default")))
# define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x
# else
# define SHPAPI_CALL
# endif
#endif
#ifndef SHPAPI_CALL1
# define SHPAPI_CALL1(x) x SHPAPI_CALL
#endif
/* -------------------------------------------------------------------- */
/* Macros for controlling CVSID and ensuring they don't appear */
/* as unreferenced variables resulting in lots of warnings. */
/* -------------------------------------------------------------------- */
#ifndef DISABLE_CVSID
# if defined(__GNUC__) && __GNUC__ >= 4
# define SHP_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
# else
# define SHP_CVSID(string) static const char cpl_cvsid[] = string; \
static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
# endif
#else
# define SHP_CVSID(string)
#endif
/* -------------------------------------------------------------------- */
/* On some platforms, additional file IO hooks are defined that */
/* UTF-8 encoded filenames Unicode filenames */
/* -------------------------------------------------------------------- */
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define SHPAPI_WINDOWS
# define SHPAPI_UTF8_HOOKS
#endif
/* -------------------------------------------------------------------- */
/* IO/Error hook functions. */
/* -------------------------------------------------------------------- */
typedef int *SAFile;
#ifndef SAOffset
typedef unsigned long SAOffset;
#endif
typedef struct {
SAFile (*FOpen) ( const char *filename, const char *access);
SAOffset (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile file);
SAOffset (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile file);
SAOffset (*FSeek) ( SAFile file, SAOffset offset, int whence );
SAOffset (*FTell) ( SAFile file );
int (*FFlush)( SAFile file );
int (*FClose)( SAFile file );
int (*Remove) ( const char *filename );
void (*Error) ( const char *message );
double (*Atof) ( const char *str );
} SAHooks;
void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
#ifdef SHPAPI_UTF8_HOOKS
void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
#endif
/************************************************************************/
/* SHP Support. */
/************************************************************************/
typedef struct tagSHPObject SHPObject;
typedef struct
{
SAHooks sHooks;
SAFile fpSHP;
SAFile fpSHX;
int nShapeType; /* SHPT_* */
unsigned int nFileSize; /* SHP file */
int nRecords;
int nMaxRecords;
unsigned int*panRecOffset;
unsigned int *panRecSize;
double adBoundsMin[4];
double adBoundsMax[4];
int bUpdated;
unsigned char *pabyRec;
int nBufSize;
int bFastModeReadObject;
unsigned char *pabyObjectBuf;
int nObjectBufSize;
SHPObject* psCachedObject;
} SHPInfo;
typedef SHPInfo * SHPHandle;
/* -------------------------------------------------------------------- */
/* Shape types (nSHPType) */
/* -------------------------------------------------------------------- */
#define SHPT_NULL 0
#define SHPT_POINT 1
#define SHPT_ARC 3
#define SHPT_POLYGON 5
#define SHPT_MULTIPOINT 8
#define SHPT_POINTZ 11
#define SHPT_ARCZ 13
#define SHPT_POLYGONZ 15
#define SHPT_MULTIPOINTZ 18
#define SHPT_POINTM 21
#define SHPT_ARCM 23
#define SHPT_POLYGONM 25
#define SHPT_MULTIPOINTM 28
#define SHPT_MULTIPATCH 31
/* -------------------------------------------------------------------- */
/* Part types - everything but SHPT_MULTIPATCH just uses */
/* SHPP_RING. */
/* -------------------------------------------------------------------- */
#define SHPP_TRISTRIP 0
#define SHPP_TRIFAN 1
#define SHPP_OUTERRING 2
#define SHPP_INNERRING 3
#define SHPP_FIRSTRING 4
#define SHPP_RING 5
/* -------------------------------------------------------------------- */
/* SHPObject - represents on shape (without attributes) read */
/* from the .shp file. */
/* -------------------------------------------------------------------- */
struct tagSHPObject
{
int nSHPType;
int nShapeId; /* -1 is unknown/unassigned */
int nParts;
int *panPartStart;
int *panPartType;
int nVertices;
double *padfX;
double *padfY;
double *padfZ;
double *padfM;
double dfXMin;
double dfYMin;
double dfZMin;
double dfMMin;
double dfXMax;
double dfYMax;
double dfZMax;
double dfMMax;
int bMeasureIsUsed;
int bFastModeReadObject;
};
/* -------------------------------------------------------------------- */
/* SHP API Prototypes */
/* -------------------------------------------------------------------- */
/* If pszAccess is read-only, the fpSHX field of the returned structure */
/* will be NULL as it is not necessary to keep the SHX file open */
SHPHandle SHPAPI_CALL
SHPOpen( const char * pszShapeFile, const char * pszAccess );
SHPHandle SHPAPI_CALL
SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
SAHooks *psHooks );
SHPHandle SHPAPI_CALL
SHPOpenLLEx( const char *pszShapeFile, const char *pszAccess,
SAHooks *psHooks, int bRestoreSHX );
int SHPAPI_CALL
SHPRestoreSHX( const char *pszShapeFile, const char *pszAccess,
SAHooks *psHooks );
/* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the SHPHandle. */
/* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
/* The SHPObject padfZ and padfM members may be NULL depending on the geometry */
/* type. It is illegal to free at hand any of the pointer members of the SHPObject structure */
void SHPAPI_CALL SHPSetFastModeReadObject( SHPHandle hSHP, int bFastMode );
SHPHandle SHPAPI_CALL
SHPCreate( const char * pszShapeFile, int nShapeType );
SHPHandle SHPAPI_CALL
SHPCreateLL( const char * pszShapeFile, int nShapeType,
SAHooks *psHooks );
void SHPAPI_CALL
SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
double * padfMinBound, double * padfMaxBound );
SHPObject SHPAPI_CALL1(*)
SHPReadObject( SHPHandle hSHP, int iShape );
int SHPAPI_CALL
SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
void SHPAPI_CALL
SHPDestroyObject( SHPObject * psObject );
void SHPAPI_CALL
SHPComputeExtents( SHPObject * psObject );
SHPObject SHPAPI_CALL1(*)
SHPCreateObject( int nSHPType, int nShapeId, int nParts,
const int * panPartStart, const int * panPartType,
int nVertices,
const double * padfX, const double * padfY,
const double * padfZ, const double * padfM );
SHPObject SHPAPI_CALL1(*)
SHPCreateSimpleObject( int nSHPType, int nVertices,
const double * padfX,
const double * padfY,
const double * padfZ );
int SHPAPI_CALL
SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
void SHPAPI_CALL SHPClose( SHPHandle hSHP );
void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
const char SHPAPI_CALL1(*)
SHPTypeName( int nSHPType );
const char SHPAPI_CALL1(*)
SHPPartTypeName( int nPartType );
/* -------------------------------------------------------------------- */
/* Shape quadtree indexing API. */
/* -------------------------------------------------------------------- */
/* this can be two or four for binary or quad tree */
#define MAX_SUBNODE 4
/* upper limit of tree levels for automatic estimation */
#define MAX_DEFAULT_TREE_DEPTH 12
typedef struct shape_tree_node
{
/* region covered by this node */
double adfBoundsMin[4];
double adfBoundsMax[4];
/* list of shapes stored at this node. The papsShapeObj pointers
or the whole list can be NULL */
int nShapeCount;
int *panShapeIds;
SHPObject **papsShapeObj;
int nSubNodes;
struct shape_tree_node *apsSubNode[MAX_SUBNODE];
} SHPTreeNode;
typedef struct
{
SHPHandle hSHP;
int nMaxDepth;
int nDimension;
int nTotalCount;
SHPTreeNode *psRoot;
} SHPTree;
SHPTree SHPAPI_CALL1(*)
SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
double *padfBoundsMin, double *padfBoundsMax );
void SHPAPI_CALL
SHPDestroyTree( SHPTree * hTree );
int SHPAPI_CALL
SHPWriteTree( SHPTree *hTree, const char * pszFilename );
int SHPAPI_CALL
SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
int SHPAPI_CALL
SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId );
void SHPAPI_CALL
SHPTreeTrimExtraNodes( SHPTree * hTree );
int SHPAPI_CALL1(*)
SHPTreeFindLikelyShapes( SHPTree * hTree,
double * padfBoundsMin,
double * padfBoundsMax,
int * );
int SHPAPI_CALL
SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
int SHPAPI_CALL1(*)
SHPSearchDiskTree( FILE *fp,
double *padfBoundsMin, double *padfBoundsMax,
int *pnShapeCount );
typedef struct SHPDiskTreeInfo* SHPTreeDiskHandle;
SHPTreeDiskHandle SHPAPI_CALL
SHPOpenDiskTree( const char* pszQIXFilename,
SAHooks *psHooks );
void SHPAPI_CALL
SHPCloseDiskTree( SHPTreeDiskHandle hDiskTree );
int SHPAPI_CALL1(*)
SHPSearchDiskTreeEx( SHPTreeDiskHandle hDiskTree,
double *padfBoundsMin, double *padfBoundsMax,
int *pnShapeCount );
int SHPAPI_CALL
SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks );
/* -------------------------------------------------------------------- */
/* SBN Search API */
/* -------------------------------------------------------------------- */
typedef struct SBNSearchInfo* SBNSearchHandle;
SBNSearchHandle SHPAPI_CALL
SBNOpenDiskTree( const char* pszSBNFilename,
SAHooks *psHooks );
void SHPAPI_CALL
SBNCloseDiskTree( SBNSearchHandle hSBN );
int SHPAPI_CALL1(*)
SBNSearchDiskTree( SBNSearchHandle hSBN,
double *padfBoundsMin, double *padfBoundsMax,
int *pnShapeCount );
int SHPAPI_CALL1(*)
SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
int bMinX, int bMinY, int bMaxX, int bMaxY,
int *pnShapeCount );
void SHPAPI_CALL SBNSearchFreeIds( int* panShapeId );
/************************************************************************/
/* DBF Support. */
/************************************************************************/
typedef struct
{
SAHooks sHooks;
SAFile fp;
int nRecords;
int nRecordLength; /* Must fit on uint16 */
int nHeaderLength; /* File header length (32) + field
descriptor length + spare space.
Must fit on uint16 */
int nFields;
int *panFieldOffset;
int *panFieldSize;
int *panFieldDecimals;
char *pachFieldType;
char *pszHeader; /* Field descriptors */
int nCurrentRecord;
int bCurrentRecordModified;
char *pszCurrentRecord;
int nWorkFieldLength;
char *pszWorkField;
int bNoHeader;
int bUpdated;
union
{
double dfDoubleField;
int nIntField;
} fieldValue;
int iLanguageDriver;
char *pszCodePage;
int nUpdateYearSince1900; /* 0-255 */
int nUpdateMonth; /* 1-12 */
int nUpdateDay; /* 1-31 */
int bWriteEndOfFileChar; /* defaults to TRUE */
} DBFInfo;
typedef DBFInfo * DBFHandle;
typedef enum {
FTString,
FTInteger,
FTDouble,
FTLogical,
FTDate,
FTInvalid
} DBFFieldType;
/* Field descriptor/header size */
#define XBASE_FLDHDR_SZ 32
/* Shapelib read up to 11 characters, even if only 10 should normally be used */
#define XBASE_FLDNAME_LEN_READ 11
/* On writing, we limit to 10 characters */
#define XBASE_FLDNAME_LEN_WRITE 10
/* Normally only 254 characters should be used. We tolerate 255 historically */
#define XBASE_FLD_MAX_WIDTH 255
DBFHandle SHPAPI_CALL
DBFOpen( const char * pszDBFFile, const char * pszAccess );
DBFHandle SHPAPI_CALL
DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
SAHooks *psHooks );
DBFHandle SHPAPI_CALL
DBFCreate( const char * pszDBFFile );
DBFHandle SHPAPI_CALL
DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
DBFHandle SHPAPI_CALL
DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHooks *psHooks );
int SHPAPI_CALL
DBFGetFieldCount( DBFHandle psDBF );
int SHPAPI_CALL
DBFGetRecordCount( DBFHandle psDBF );
int SHPAPI_CALL
DBFAddField( DBFHandle hDBF, const char * pszFieldName,
DBFFieldType eType, int nWidth, int nDecimals );
int SHPAPI_CALL
DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
char chType, int nWidth, int nDecimals );
int SHPAPI_CALL
DBFDeleteField( DBFHandle hDBF, int iField );
int SHPAPI_CALL
DBFReorderFields( DBFHandle psDBF, int* panMap );
int SHPAPI_CALL
DBFAlterFieldDefn( DBFHandle psDBF, int iField, const char * pszFieldName,
char chType, int nWidth, int nDecimals );
DBFFieldType SHPAPI_CALL
DBFGetFieldInfo( DBFHandle psDBF, int iField,
char * pszFieldName, int * pnWidth, int * pnDecimals );
int SHPAPI_CALL
DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
int SHPAPI_CALL
DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
double SHPAPI_CALL
DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
const char SHPAPI_CALL1(*)
DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
const char SHPAPI_CALL1(*)
DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
int SHPAPI_CALL
DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
int SHPAPI_CALL
DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
int nFieldValue );
int SHPAPI_CALL
DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
double dFieldValue );
int SHPAPI_CALL
DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
const char * pszFieldValue );
int SHPAPI_CALL
DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
int SHPAPI_CALL
DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
const char lFieldValue);
int SHPAPI_CALL
DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
void * pValue );
const char SHPAPI_CALL1(*)
DBFReadTuple(DBFHandle psDBF, int hEntity );
int SHPAPI_CALL
DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
int bIsDeleted );
DBFHandle SHPAPI_CALL
DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
void SHPAPI_CALL
DBFClose( DBFHandle hDBF );
void SHPAPI_CALL
DBFUpdateHeader( DBFHandle hDBF );
char SHPAPI_CALL
DBFGetNativeFieldType( DBFHandle hDBF, int iField );
const char SHPAPI_CALL1(*)
DBFGetCodePage(DBFHandle psDBF );
void SHPAPI_CALL
DBFSetLastModifiedDate( DBFHandle psDBF, int nYYSince1900, int nMM, int nDD );
void SHPAPI_CALL DBFSetWriteEndOfFileChar( DBFHandle psDBF, int bWriteFlag );
#ifdef __cplusplus
}
#endif
#endif /* ndef SHAPEFILE_H_INCLUDED */

95
src/cpp/shp_2_txt.cpp Normal file
View file

@ -0,0 +1,95 @@
/*
http://shapelib.maptools.org/dbf_api.html
basic funtionality taken from dbfdump.c
path to libshp.dll has to be added as a PATH var
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
#include "shapefil.h"
int main(int argc, char const *argv[])
{ string dbf_filename;
string txt_filename;
if (argc == 1)
{
// no arguments given, print help
cout << "No input and output files defined!" << endl;
cout << "example: shp_2_txt -i MA.dbf -o MA.txt" << endl;
return 0;
}
// parse arguments
for (int i = 1; i < argc; i++)
{
if (argv[i][0] == '\0')
{
continue;
}
else if (strcmp(argv[i],"-i") == 0)
{
dbf_filename = argv[i + 1];
}
else if (strcmp(argv[i],"-o") == 0 )
{
txt_filename = argv[i + 1];
}
}
DBFHandle dbfh;
int i, iRecord;
char szTitle[12];
cout << dbf_filename << " " << txt_filename << endl;
// open textfile and dbf handle
ofstream txt_file(txt_filename);
dbfh = DBFOpen(dbf_filename.c_str(), "rb");
// check
if (dbfh <= 0)
{
throw string("File " + dbf_filename + " not found");
}
else
{
// loop over dbf records
for( iRecord = 0; iRecord < DBFGetRecordCount(dbfh); iRecord++ )
{
// loop over fields of record
for( i = 0; i < DBFGetFieldCount(dbfh); i++ )
{
// DBFFieldType eType;
// eType = DBFGetFieldInfo( dbfh, i, szTitle, &nWidth, &nDecimals );
string dec_lat = "DEC_LAT";
string dec_lon = "DEC_LON";
string ellip_h = "ELLIP_HT";
string ortho_h = "ORTHO_HT";
string str(szTitle);
string line;
// parse for lat, lon in degrees and orhto height
if (szTitle == dec_lat or szTitle == dec_lon or szTitle == ortho_h)
{
txt_file << DBFReadStringAttribute( dbfh, iRecord, i );
txt_file << " ";
}
}
txt_file << endl;
}
// close dbf handle and textfile
DBFClose( dbfh );
txt_file.close();
cout << "Done." << endl;
}
return 0;
}

22
src/python/shp_2_txt.py Normal file
View file

@ -0,0 +1,22 @@
# OrderedDict([('FeatureId', None), ('DATA_DATE', '20190402'), ('DATA_SRCE', 'http://www.ngs.noaa.gov/cgi-bin/ds_mark.prl?PidBox=DF6866'),
# ('PID', 'DF6866'), ('NAME', '204 S'), ('HT_MOD', ''), ('CORS_ID', ''), ('PACS_SACS', ''), ('STATE', 'MA'),
# ('COUNTY', 'PLYMOUTH'), ('QUAD', ''), ('LATITUDE', '41 48 42.93229(N)'), ('LONGITUDE', '070 57 49.32872(W)'),
# ('DEC_LAT', ' 41.8119256361'), ('DEC_LON', ' -70.9637024222'), ('ELLIP_HT', ''), ('POS_DATUM', 'NAD 83'), ('DATUM_TAG', '(1996)'),
# ('POS_EPOCH', ''), ('POS_SRCE', 'ADJUSTED'), ('ORTHO_HT', ' 18.5'), ('VERT_DATUM', 'NAVD 88'), ('VERT_EPOCH', ''), ('VERT_SRCE', 'VERTCON'),
# ('GEOID_HT', '-29.000'), ('GEOID_MOD', 'GEOID12B'), ('DYNAMIC_HT', ''), ('MODEL_GRAV', ''),
# ('N_ACC_HZ', ''), ('N_ACC_EH', ''), ('N_ACC_STDN', ''), ('N_ACC_STDE', ''), ('N_ACC_STDH', ''), ('N_ACC_CORR', ''),
# ('POS_ORDER', '2'), ('VERT_ORDER', ''), ('VERT_CLASS', ''), ('DIST_RATE', ''), ('ECEF_X', ''), ('ECEF_Y', ''), ('ECEF_Z', ''),
# ('SPC_ZONE', 'MA M'), ('SPC_NORTH', '840320.139'), ('SPC_EAST', '244562.406'), ('SPC_CONV', '+0 21 36.9'), ('SPC_CSF', '0.99998907'),
# ('UTM_ZONE', '19'), ('UTM_NORTH', '4630758.769'), ('UTM_EAST', '336889.228'), ('UTM_CONV', '-1 18 34.1'), ('UTM_CSF', '0.99992904'),
# ('STABILITY', 'C'), ('FIRST_RECV', '1972'), ('LAST_RECV', '1972'), ('LAST_COND', 'MONUMENTED'), ('LAST_RECBY', 'MAGS'), ('SAT_USE', ''),
# ('MARKER', 'DE = TRAVERSE STATION DISK'), ('SETTING', '7 = SET IN TOP OF CONCRETE MONUMENT'), ('STAMPING', '204 S')])
from dbfread import DBF
dbf_file = DBF("f:\\testing\\shp_2_txt\\MA.dbf", load=True, encoding='utf8')
txt_file = open("f:\\testing\\shp_2_txt\\MA.txt", 'w')
for idx, record in enumerate(dbf_file):
txt_file.write(str(record['DEC_LON'] + record['DEC_LAT'] + record['ELLIP_HT'] + record['ORTHO_HT']) + '\n')
txt_file.close()

BIN
testing/MA.dbf Normal file

Binary file not shown.

1
testing/MA.prj Normal file
View file

@ -0,0 +1 @@
GEOGCS["GCS_NAD_1983_2011",DATUM["D_NAD_1983_2011",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

BIN
testing/MA.shp Normal file

Binary file not shown.

917
testing/MA.shp.xml Normal file
View file

@ -0,0 +1,917 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<metadata>
<idinfo>
<citation>
<citeinfo>
<origin>NOAA, National Geodetic Survey</origin>
<pubdate>20190402</pubdate>
<title>Horizontal and Vertical Geodetic Control Data for the Unites States.</title>
<edition>latest available</edition>
<geoform>Diagram</geoform>
<serinfo>
<sername>N/A</sername>
<issue>N/A</issue>
</serinfo>
<pubinfo>
<pubplace>NOAA Campus, Silver Spring, MD</pubplace>
<publish>NOAA, National Geodetic Survey</publish>
</pubinfo>
<othercit>
Questions concerning this data
may be addressed to
NGS Information Services Branch
EMail - ngs.software@noaa.gov
Phone - 301-713-3242
</othercit>
<onlink>&lt;http://www.ngs.noaa.gov/cgi-bin/datasheet.prl&gt;</onlink>
</citeinfo>
</citation>
<descript>
<abstract>
This data contains a set of geodetic control stations
maintained by the National Geodetic Survey.
Each geodetic control station in this dataset
has either a precise Latitude/Longitude used
for horizontal control or a precise Orthometric Height
used for vertical control, or both.
The National Geodetic Survey (NGS) serves
as the Nation's depository for geodetic data. The NGS
distributes geodetic data worldwide to a variety of
users. These geodetic data include the final results
of geodetic surveys, software programs to format,
compute, verify, and adjust original survey
observations or to convert values from one geodetic
datum to another, and publications that describe how to
obtain and use Geodetic Data products and services.
</abstract>
<purpose>
Provide a base of reference for latitude, longitude and height
throughout the United States.
</purpose>
</descript>
<timeperd>
<timeinfo>
<sngdate>
<caldate>20190402</caldate>
</sngdate>
</timeinfo>
<current>retrieval date</current>
</timeperd>
<status>
<progress>Complete</progress>
<update>Continually</update>
</status>
<spdom>
<bounding>
<westbc>-73.5</westbc>
<eastbc>-69.9</eastbc>
<northbc>42.9</northbc>
<southbc>41.2</southbc>
</bounding>
</spdom>
<keywords>
<theme>
<themekt>geodesy</themekt>
<themekey>
NSRS, geodetic, horizontal control,
vertical control, ellipsoid height, benchmark,
orthometric height, latitude, longitude
</themekey>
</theme>
<place>
<placekt>None</placekt>
<placekey>The geographic limits of USA including trust Territories</placekey>
</place>
<stratum>
<stratkt>N/A</stratkt>
<stratkey>N/A</stratkey>
</stratum>
<temporal>
<tempkt>N/A</tempkt>
<tempkey>N/A</tempkey>
</temporal>
</keywords>
<accconst>
Geodetic Data are in the public
domain, not restricted from access or distribution.
</accconst>
<useconst>
Not restricted; Geodetic Data,
including software were developed and compiled with
U.S. Government funding; no proprietary rights may be
attached to them nor may they be sold to the U.S.
Government as part of any procurement of ADP products
or services.
</useconst>
<ptcontac>
<cntinfo>
<cntperp>
<cntper>NGS Information Services Branch</cntper>
<cntorg>NOAA, National Geodetic Survey</cntorg>
</cntperp>
<cntpos>Information Specialist</cntpos>
<cntaddr>
<addrtype>Mailing and Physical Address</addrtype>
<address>
SSMC3/9202
1315 East-west Highway
</address>
<city>Silver Spring</city>
<state>MD</state>
<postal>20910</postal>
<country>USA</country>
</cntaddr>
<cntvoice>301-713-3242</cntvoice>
<cntfax>301-713-4172</cntfax>
<cntemail>ngs.infocenter@noaa.gov</cntemail>
<hours>7:00am to 4:30pm EST</hours>
<cntinst>Prefer EMail</cntinst>
</cntinfo>
</ptcontac>
<datacred>
NOAA, National Geodetic Survey and
cooperating organizations
</datacred>
<secinfo>
<secsys>DOD</secsys>
<secclass>unclassified</secclass>
<sechandl>none</sechandl>
</secinfo>
<native>
The data was extracted from NGS datasheets which
are available at &lt;http://www.ngs.noaa.gov/cgi-bin/datasheet.prl&gt;
The NGS datasheet is a text document which summarizes
key geodetic information stored in the NGS database.
</native>
</idinfo>
<dataqual>
<attracc>
<attraccr>
Horizontal control stations (those with precise Latitude, Longitude)
were established in accordance with FGDC publications
"Standards and Specifications for Geodetic Accuracy Standards"
and "Geometric Geodetic Accuracy Standards and Specifications for
Using GPS Relative Positioning Techniques"
The final Latitude, Longitude of these stations were determined
by a least squares adjustments of the horizontal observations.
Horizontal control station have Latitude, Longitudes displayed
to 5 places and are identified by attribute POS_SRCE = 'ADJUSTED'
Lesser quality Latitude, Longitudes may also be preset in the dataset.
These are identified by a POS_SRCE attributes
HD_HELD1, HD_HELD2, or SCALED.
These lesser quality positions are described at:
&lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=SCALED&gt;
Vertical control stations (those with precise Orthometric Heights)
were established in accordance with FGDC publications
"Standards and Specifications for Geodetic Accuracy Standards"
The final Orthometric Height of these stations were in most cases
determined by a least squares adjustments of the vertical observations
but in some cases may have been keyed from old survey documents.
Vertical control stations have Orthometric Heights displayed
to 2 or 3 places and are identified by attribute ELEV_SRCE of
ADJUSTED, ADJ UNCH, POSTED,READJUST,N HEIGHT,RESET,COMPUTED
Lesser quality Orthometric Heights may also be preset in the dataset.
These are identified by a ELEV_SRCE attributes
GPS_OBS, VERT_ANG, H_LEVEL, VERTCON, SCALED.
These lesser quality orthometric heights are described at:
&lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=SCALED&gt;
IMPORTANT - Control stations do not always have both precise
Latitude, Longitude AND precise Orthometric Height.
A horizontal control station may have a orthometric
height associated with it which is of non geodetic quality.
These types of heights are displayed to 0, 1, or 2 decimal
places. Worst case being off by +/- 1 meter.
LIKEWISE - A Vertical control station may have a Latitude, Longitude
associated with it which is of non geodetic quality.
These types of Latitude, Longitudes are displayed to 0, 1 or 2 decimal
places. Worst case being off by +/- 180 meter.
Refer to &lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=SCALED&gt;
for a description of the various type of methods used in determining
the Latitude, Longitude, and Orthometric Height.
Attribute POS_CHECK and ELEV_CHECK indicate whether or not
an observational check was made to the position and/or orthometric height.
Care should be taken when using "No Check" coordinates.
If attribute ELEV_SRCE = 'VERTCON' then the Orthometric Height was
determined by applying NGS program VERTCON to an Old NGVD 29 height.
In most areas VERTCON gives results to +/- 2 cm.
See &lt;http://www.ngs.noaa.gov/TOOLS/Vertcon/vertcon.html&gt; for a more
detailed explanation of VERTCON accuracy.
Ellipsoid Heights are also present in the dataset.
The ellipsoid heights consist of those determined using a precise
geoid model, which are displayed to 2 decimal places and are considered
good to +/- .005 meters, and those displayed to 1 decimal place and are considered
only good to +/- .5 meters
</attraccr>
<qattracc>
<attraccv>95 percent confidence level for geodetic quality data.</attraccv>
<attracce>
Geodetic Data are continuously being processed;
their standards and specifications are being reviewed for next
publication release. "Standards and Specifications for Geodetic Control Networks",
1984 and "Geometric Geodetic Accuracy Standards
and Specifications for Using GPS Relative
Positioning Techniques," FGCS (formally FGCC)
publication version 5.0 1989, are most current
published documents.
</attracce>
</qattracc>
</attracc>
<logic>
FGCS sponsored testing in cooperation with equipment
manufacturers and National Institutes of Standards
and Technology, Gaithersburg, MD 20850
</logic>
<complete>
This dataset DOES NOT include destroyed marks.
All other non-publishable marks are NOT included.
Non-publishable criteria is available at
&lt;http://www.ngs.noaa.gov/cgi-bin/craigs_lib.prl?HELP_NONPUB=1&gt;
</complete>
<posacc>
<horizpa>
<horizpar>
The description of tests are explained in "Geometric
Geodetic Accuracy Standards and Specifications For
Using GPS Relative Positioning Techniques," FGCS
(formally FGCC) publication version 5.0, 1989.
</horizpar>
<qhorizpa>
<horizpav>.05 meters for highest order of accuracy</horizpav>
<horizpae>
Horizontal positional accuracy statements pertain
to horizontal control stations only.
i.e. Those with geodetic quality Latitude, Longitudes.
Positional Accuracy explanation contained in
"Geometric Geodetic Accuracy Standards and
Specifications For Using GPS Relative Positioning
Techniques," FGCS (formally FGCC) publication
version 5.0, 1989, (See table 1, p6).
with the exception of Order A and Order B which
have an accuracy of as described at:
&lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=HORZ%20ORDER&gt;
</horizpae>
</qhorizpa>
</horizpa>
<vertacc>
<vertaccr>
The description of tests are explained in "Geometric Geodetic
Accuracy Standards and Specifications for Using
GPS Relative Positioning Techniques," FGCS
(formally FGCC) publication version 5.0, 1989,
(See table 1, p6).
</vertaccr>
<qvertpa>
<vertaccv>.05 meter for highest order of accuracy</vertaccv>
<vertacce>
Vertical positional accuracy statements pertain
to vertical control stations only.
i.e. Those with geodetic quality Orthometric Heights.
Orthometric Height accuracy explanation is contained in
FGDC publication "Standards and Specifications for Geodetic Control Networks"
with the exception of vertical control of class 0
POSTED and READJUSTED Heights which are described at:
&lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=VERT%20ORDER&gt;
Ellipsoid height accuracy explanation contained in
"Geometric Geodetic Accuracy Standards and
Specifications for Using GPS Relative Positioning
Techniques," FGCS (formally FGCC) publication
version 5.0, 1989. (see table 1, p6).
The accuracies for ellipsoid heights are described at:
&lt;http://www.ngs.noaa.gov/cgi-bin/ds_lookup.prl?Item=ELLP%20ORDER&gt;
</vertacce>
</qvertpa>
</vertacc>
</posacc>
<lineage>
<srcinfo>
<srccite>
<citeinfo>
<origin>NOAA, National Geodetic Survey</origin>
<pubdate>20190402</pubdate>
<title>
"Input Formats and Specifications of the
National Geodetic Survey Data Base" published by
FGCS (formally FGCC)
</title>
<edition>latest available</edition>
<geoform>diagram</geoform>
<serinfo>
<sername>N/A</sername>
<issue>N/A</issue>
</serinfo>
<pubinfo>
<pubplace>NOAA Campus, Silver Spring, MD</pubplace>
<publish>NOAA, National Geodetic Survey</publish>
</pubinfo>
<othercit>N/A</othercit>
<onlink>&lt;http://www.ngs.noaa.gov/FGCS/BlueBook/&gt;</onlink>
</citeinfo>
</srccite>
<typesrc>paper, Web</typesrc>
<srctime>
<timeinfo>
<sngdate>
<caldate>1994</caldate>
</sngdate>
</timeinfo>
<srccurr>publication date</srccurr>
</srctime>
<srccitea>Blue Book</srccitea>
<srccontr>
The geodetic data must be
submitted in the digital formats specified in the
FGCS (formally FGCC) publication "Input Formats
and Specifications of the National Geodetic Survey
Data Base" which describes the formats and
procedures for submission of data for adjustment
and assimilation into the National Geodetic Survey
Data Base. Separate volumes of this publication
refer to horizontal (volume 1), vertical (volume
2), and gravity (volume 3) control, and are
available from NOAA, National Geodetic Survey,
1315 East-West Hwy, Code N/CGS1, Silver Spring,
MD, 20910 (1-301-713-3242). Note guidelines for
submission of three-dimensional Global Positioning
System (GPS) relative positioning data are
contained in annex L to volume 1.
</srccontr>
</srcinfo>
<procstep>
<procdesc>
The National Geodetic Survey
produces geodetic data. Geodetic data comprise
the results of geodetic surveys to determine,
among other things, latitude, longitude, height,
scale, and orientation control. The National
Geodetic Survey original field survey project
observations and final reports are accessioned
into records system of the National Archives and
Records Administration of the U.S.A. These
surveys provide information valuable for a variety
of uses in the mapping, charting and surveying
community.
The NGS' final product is the geodetic data sheet.
Geodetic data sheets are comprehensive summaries
of all published information for a given
geodetic reference point, including:
the geographic position and/or height based on the
current reference datum, condition of the survey
mark when it was last visited, a description of
where the point is located and how to reach it,
and an explanation of the terms used in the data
sheet. In support of these geodetic data, the NGS
provides software, publications, and various user
services, including geodetic advisor program,
instrument calibration, surveying standards, and
technical workshops.
This dataset contains certain information extracted
from the above mentioned data sheet.
</procdesc>
<srcused>Geodetic Data</srcused>
<procdate>Not complete</procdate>
<srcprod>NOAA, National Geodetic Survey and cooperating organizations.</srcprod>
<proccont>
<cntinfo>
<cntperp>
<cntper>NGS Information Services Branch</cntper>
</cntperp>
<cntpos>Information Specialist</cntpos>
<cntaddr>
<addrtype>Mailing and Physical Address</addrtype>
<address>
SSMC3/9202
1315 East-west Highway
</address>
<city>Silver Spring</city>
<state>MD</state>
<postal>20910</postal>
<country>USA</country>
</cntaddr>
<cntvoice>301-713-3242</cntvoice>
<cntfax>301-713-4172</cntfax>
<cntemail>ngs.infocenter@noaa.gov</cntemail>
<hours>9:00am to 4:30pm EST</hours>
<cntinst>Prefer EMail</cntinst>
</cntinfo>
</proccont>
</procstep>
</lineage>
</dataqual>
<spdoinfo>
<indspref>
Geodetic Data- horizontal positional datum
conversion, use program NADCON (version 2.1)
Geodetic Data - vertical positional datum
conversion, use program VERTCON (version 2.0)
These programs provide indirect spatial reference
data and are available from NOAA, National
Geodetic Survey at
&lt;http://www.ngs.noaa.gov/PC_PROD/pc_prod.shtml&gt;
</indspref>
<direct>point</direct>
<ptvctinf>
<sdtsterm>
<sdtstype>point</sdtstype>
<ptvctcnt>1,500,000</ptvctcnt>
</sdtsterm>
</ptvctinf>
</spdoinfo>
<spref>
<horizsys>
<geograph>
<latres>0.00001</latres>
<longres>0.00001</longres>
<geogunit>degrees, minutes, and decimal seconds</geogunit>
</geograph>
<geodetic>
<horizdn>North American Datum of 1983 (NAD 83)</horizdn>
<ellips>Geodetic Reference System 80 (GRS80)</ellips>
<semiaxis>6378137</semiaxis>
<denflat>298.26</denflat>
</geodetic>
</horizsys>
<vertdef>
<altsys>
<altdatum>
North American Vertical Datum of 1988 (NAVD 88),
including Ellipsoidal and Orthometric
Heights.
</altdatum>
<altres>.01</altres>
<altunits>meters</altunits>
<altenc>implicit coordinate</altenc>
</altsys>
<depthsys>
<depthdn>the local surface</depthdn>
<depthres>.01</depthres>
<depthdu>meters</depthdu>
<depthem>implicit coordinate</depthem>
</depthsys>
</vertdef>
</spref>
<eainfo>
<overview>
<eaover>
The current attributes and their meaning are shown below.
#FeatureId
Temporary unique ID assigned to this station.
DATA_DATE-
The date when this information was retrieved from the NGS database.
DATA_SRCE-
Data Source where the information for the mark came from.
You should use this link to obtain a full datasheet for the mark
or obtain the datasheets from http://www.ngs.noaa.gov/cgi-bin/datasheet.prl
if you intend to use the data for survey control.
DEC_LONG-
Decimal equivalent of the LONGITUDE
Always displayed to 10 decimal places, but you should
see POS_SRCE and POS_ORDER to determine the true accuracy.
DEC_LAT-
Decimal equivalent of the LATITUDE
PID-
Permanent Identifier assigned by NGS to each mark
NAME-
Station Name (a.k.a. Designation)
STATE-
State Code
COUNTY-
County Name
QUAD-
USGS Topographic Quad Map Name
LATITUDE-
Latitude in Deg-Min-Sec format
LONGITUDE-
Longitude in Deg-Min-Sec format
POS_DATUM-
Datum of the LATITUDE,LONGITUDE
Should always be NAD83
DATUM_TAG-
Datum Tag of the LATITUDE,LONGITUDE
NAD83 (1986) indicates positions on the NAD83 datum for the
North American Adjustment, completed in 1986.
NAD83 (nnnn) indicates positions on the NAD83 datum for the
North American Adjustment, but readjusted to a State High
Accuracy Reference Network (HARN) on the date shown in (nnnn).
NAD83 (CORS) indicates positions which are part of the CORS
network.
POS_SRCE-
Position Source for the LATITUDE,LONGITUDE
ADJUSTED = Least squares adjustment.
(Lat,Lon Rounded to 5 decimal places.)
HD_HELD1 = Differentially corrected hand held GPS observations.
(Lat,Lon Rounded to 2 decimal places.)
HD_HELD2 = Autonomous hand held GPS observations.
(Lat,Lon Rounded to 1 decimal places.)
SCALED = Scaled from a topographic map.
(Lat,Lon Rounded to 0 decimal places.)
ORTHO_HT-
Present if available.
The Orthometric Height in METERS indicating the height above the Geoid.
VERT_DATUM-
Datum of the ORTHO_HT
VERT_SRCE-
Vertical Source for the ORTHO_HT
ADJUSTED = Direct Digital Output from Least Squares Adjustment
of Precise Leveling.
(Rounded to 3 decimal places.)
ADJ UNCH = Manually Entered (and NOT verified) Output of
Least Squares Adjustment of Precise Leveling.
(Rounded to 3 decimal places.)
POSTED = Pre-1991 Precise Leveling Adjusted to
the NAVD 88 Network After Completion of
the NAVD 88 General Adjustment of 1991.
(Rounded to 3 decimal places.)
READJUST = Precise Leveling Readjusted as Required
by Crustal Motion or Other Cause.
(Rounded to 2 decimal places.)
N HEIGHT = Computed from Precise Leveling Connected
at Only One Published Bench Mark.
(Rounded to 2 decimal places.)
RESET = Reset Computation of Precise Leveling.
(Rounded to 2 decimal places.)
COMPUTED = Computed from Precise Leveling Using
Non-rigorous Adjustment Technique.
(Rounded to 2 decimal places.)
LEVELING = Precise Leveling Performed by Horizontal
Field Party.
(Rounded to 2 decimal places.)
H LEVEL = Level between control points not connected
to bench mark.
(Rounded to 1 decimal places.)
GPS OBS = Computed from GPS Observations.
(Rounded to 1 decimal places.)
VERT ANG = Computed from Vertical Angle Observations.
(Rounded to 1 decimal place;
If No Check, to 0 decimal places.)
SCALED = Scaled from a Topographic Map.
(Rounded to 0 decimal places.)
U HEIGHT = Unvalidated height from precise leveling
connected at only one NSRS point.
(Rounded to 2 decimal places.)
VERTCON = The NAVD 88 height was computed by applying the
VERTCON shift value to the NGVD 29 height.
(Rounded to 0 decimal places.)
ELLIP_HT-
Present if available.
The ellipsoid height in METERS referenced to GRS80 ellipsoid.
POS_ORDER-
Order of accuracy for the LATITUDE,LONGITUDE
Should be one of the following-
A,B,1,2,3
Order and class for Orders 1, 2, and 3
are defined in the Federal Geodetic Control Committee publication
"Standards and Specifications for Geodetic Control Networks".
In addition-
Order A stations have a relative accuracy of
5 mm +/- 1-10,000,000 relative to other A-order stations.
Order B stations have a relative accuracy of
8 mm +/- 1- 1,000,000 relative to other A- and B-order stations.
VERT_ORDER-
Order of accuracy for the ORTHO_HT
Should be 1,2, or 3 for Vertical Control Stations.
Will be blank for stations used for Horizontal Control only.
Also see attribute DIST_RATE which is used for some
vertical control stations.
Vertical order and class for 1, 2, and 3
are defined in the Federal Geodetic Control
Committee publication "Standards and Specifications for Geodetic
Control Networks". In addition-
Vertical control which were determined only for the purpose of
supplying a height for Horizontal Distance Reductions are
assigned an order of 3.
Class 0 is used for special cases of
orthometric vertical control as follows-
Vertical Order/Class Tolerance Factor
-------------------- ----------------
1 class 0 2.0 mm or less
2 class 0 8.4 mm or less
3 class 0 12.0 mm or less
VERT_CLASS-
Should be 0, 1, or 2
See details under ELEV_ORDER
DIST_RATE-
Distribution rate for POSTED and READJUSTED benchmarks
which do not have an Order and Class are as follows
"Posted bench marks" are vertical control points in the NGS data
base which were excluded from the NAVD 88 general adjustment.
Some of the bench marks were excluded due to large adjustment
residuals, possibly caused by vertical movement of the bench marks
during the time interval between different leveling epochs.
Adjusted NAVD 88 are computed for posted bench marks by
supplemental adjustments.
A range of mean distribution rate corrections is listed for each
posted bench mark in the data portion of the publication.
A summary table of the mean distribution rates and their codes is
listed below. The mean distribution rate corrections which were
applied to the original leveling observations is a good
indication of the usefulness of the posted bench marks' adjusted
NAVD 88 heights.
Distribution Distribution
Rate Code Rate Correction
------------ ---------------
"a" 0.0 thru 1.0 mm/km
"b" 1.1 thru 2.0 "
"c" 2.1 thru 3.0 "
"d" 3.1 thru 4.0 "
"e" 4.1 thru 8.0 "
"f" greater than 8.0 mm/km
POSTED BENCH MARKS SHOULD BE USED WITH CAUTION. As is the case for
all leveling projects, the mandatory FGCS check leveling two-mark or
three-mark tie procedure will usually detect any isolated movement
(or other problem) at an individual bench mark. Of course, regional
movement affecting all the marks equally is not detected by the two-
or three-mark tie procedure.
FIRST_RECV-
Date when the station was first monumented
or in the case of landmarks, first observed.
LAST_RECV-
Date when the station was last recovered.
LAST_COND-
Last recovered condition of the mark.
Should be one of the following-
MONUMENTED
FIRST OBSERVED
GOOD
POOR
MARK NOT FOUND
SEE DESCRIPTION
DESTROYED
LAST_RECBY-
Agency who reported the last condition of the mark.
STABILITY-
The stability of the mark may have 1 of 4 codes as indicated below-
A = MOST RELIABLE AND EXPECTED TO HOLD POSITION/ELEVATION WELL
B = PROBABLY HOLD POSITION/ELEVATION WELL
C = MAY HOLD, BUT OF TYPE COMMONLY SUBJECT TO SURFACE MOTION
- E.G. FROST HEAVE, ETC
D = MARK OF QUESTIONABLE OR UNKNOWN STABILITY
HT_MOD-
Designates if this site is a Height Modernization site. Y - Yes.
CORS_ID-
Continuously Operating Reference Stations (CORS) site ID.
PACS_SACS-
Designates whether this is a Primary Airport Control
Station (PACS) or Secondary Airport Control Station (SACS).
GEOID_HT-
Present if available. The geoid height in METERS referenced
to the geoid model attribute.
N_ACC_HZ-
Horizontal network accuracy at the 95 percent confidence level (cm).
N_ACC_EL-
Ellipsoid height network accuracy at the 95 percent confidence level (cm).
N_ACC_STD_N-
North component of coordinate standard deviation (latitude), used to compute horizontal network accuracy (cm).
N_ACC_STD_E-
East component of coordinate standard deviation (longitude), used to compute horizontal network accuracy (cm).
N_ACC_STD_H-
Up component of coordinate standard deviation (ellipsoid height), used to compute ellipsoid height network accuracy (cm).
N_ACC_CORR-
Correlation coefficient between north and east components of coordinate standard deviation (latitude and longitude), used to compute horizontal network accuracy (unitless).
ECEF_X-
The computed Earth-Centered, Earth-Fixed X position.
ECEF_Y-
The computed Earth-Centered, Earth-Fixed Y position.
ECEF_Z-
The computed Earth-Centered, Earth-Fixed Z position.
SPC_ZONE-
The State Plane Coordinate Zone.
SPC_NORTH-
The State Plane Coordinate Northing.
SPC_EAST-
The State Plane Coordinate Easting.
SPC_CONV-
The State Plane Coordinate Convergence Angle.
SPC_CSF-
The State Plane Coordinate Combined Scale Factor.
UTM_ZONE-
The Universal Transverse Mercator Zone.
UTM_NORTH-
The Universal Transverse Mercator Northing.
UTM_EAST-
The Universal Transverse Mercator Easting.
UTM_CONV-
The Universal Transverse Mercator Convergence Angle.
UTM_CSF-
The Universal Transverse Mercator Combined Scale Factor.
DYNAMIC_HT-
The computed dynamic height at a bench mark using the
orthometric height referenced the NAVD 88 and a gravity value.
MODELEDGRAV-
The interpolated gravity value which was used in the
NAVD 88 general adjustment.
MARKER-
Identifies the type of marker.
SETTING-
Identifies the type of setting.
STAMPING-
Identifies the stamping on the disk.
</eaover>
<eadetcit>
All values were obtained from the NGA Datasheet
available at &lt;http://www.ngs.noaa.gov/cgi-bin/datasheet.prl&gt;
</eadetcit>
</overview>
</eainfo>
<distinfo>
<distrib>
<cntinfo>
<cntperp>
<cntper>NGS Information Services Branch</cntper>
<cntorg>NOAA, National Geodetic Survey</cntorg>
</cntperp>
<cntpos>Information Specialist</cntpos>
<cntaddr>
<addrtype>Mailing and Physical Address</addrtype>
<address>
SSMC3/9202
1315 East-west Highway
</address>
<city>Silver Spring</city>
<state>MD</state>
<postal>20910</postal>
<country>USA</country>
</cntaddr>
<cntvoice>301-713-3242</cntvoice>
<cntfax>301-713-4172</cntfax>
<cntemail>ngs.infocenter@noaa.gov</cntemail>
<hours>9:00am to 4:30pm EST</hours>
<cntinst>Prefer EMail</cntinst>
</cntinfo>
</distrib>
<resdesc>Datasheet Shapefile</resdesc>
<distliab>The distributor does not assume liability</distliab>
<stdorder>
<digform>
<digtinfo>
<formname>ShapeFile</formname>
<formvern>1.0</formvern>
<formverd>2013</formverd>
<filedec>Download options include PC Zip and Unix compressed tar</filedec>
</digtinfo>
<digtopt>
<onlinopt>
<computer>
<networka>
<networkr>&lt;http://www.ngs.noaa.gov/cgi-bin/datasheet.prl?Explain=ShapeFiles&gt;</networkr>
</networka>
</computer>
<accinstr>Distributed through http://www.ngs.noaa.gov/cgi-bin/datasheet.prl</accinstr>
<oncomp>SUN Solaris</oncomp>
</onlinopt>
</digtopt>
</digform>
<fees>free if you retrieve it yourself</fees>
</stdorder>
</distinfo>
<metainfo>
<metd>20130513</metd>
<metc>
<cntinfo>
<cntperp>
<cntper>NGS Information Services Branch</cntper>
<cntorg>NOAA, National Geodetic Survey</cntorg>
</cntperp>
<cntpos>Information Specialist</cntpos>
<cntaddr>
<addrtype>Mailing and Physical Address</addrtype>
<address>
SSMC3/9202
1315 East-west Highway
</address>
<city>Silver Spring</city>
<state>MD</state>
<postal>20910</postal>
<country>USA</country>
</cntaddr>
<cntvoice>301-713-3242</cntvoice>
<cntfax>301-713-4172</cntfax>
<cntemail>ngs.software@noaa.gov</cntemail>
<hours>9:00am to 4:30pm EST</hours>
<cntinst>Prefer EMail</cntinst>
</cntinfo>
</metc>
<metstdn>FGDC Content Standards for Digital Geospatial Metadata</metstdn>
<metstdv>FGDC-STD-001-1998</metstdv>
<mettc>local time</mettc>
<metac>
Geodetic Data are in the public domain, not restricted
from access or distribution.
</metac>
<metuc>
not restricted;
Geodetic Data, including software were developed
and compiled with U.S. Government funding; no
proprietary rights may be attached to them nor may
they be sold to the U.S. Government as part of any
procurement of ADP products or services.
</metuc>
<metsi>
<metscs>DOD</metscs>
<metsc>unclassified</metsc>
<metshd>none</metshd>
</metsi>
<metextns>
<onlink>N/A</onlink>
<metprof>N/A</metprof>
</metextns>
</metainfo>
</metadata>

BIN
testing/MA.shx Normal file

Binary file not shown.

7012
testing/MA.txt Normal file

File diff suppressed because it is too large Load diff

7012
testing/out.txt Normal file

File diff suppressed because it is too large Load diff