yakra / tmtools

Tools to aid in development of the TravelMapping project
0 stars 0 forks source link

GISplunge: non-arc shape types #12

Closed yakra closed 6 years ago

yakra commented 6 years ago

splunge.ini:

#################
#_Basic_options_#
#################

InputFile foo.wpt
ShapeRoot /home/yakra/gis/data/md/SHA_Routes/SHA_LINE_ROUTES_MD_2015
KeyField ID_RTE_NO
KeyValue 485

####################
#_Advanced_options_#
####################

JctSnap OFF
SegDump ON

terminal:

yakra@BiggaTomato:~/proj/chm/gisplunge$ ./20171118a
foo.wpt
/home/yakra/gis/data/md/SHA_Routes/SHA_LINE_ROUTES_MD_2015.shp
/home/yakra/gis/data/md/SHA_Routes/SHA_LINE_ROUTES_MD_2015.shx
/home/yakra/gis/data/md/SHA_Routes/SHA_LINE_ROUTES_MD_2015.dbf
ID_RTE_NO 485

DBF Filesize: 11117598 bytes.
Header Length: 545 bytes.
Record Length: 114 bytes.
ID_RTE_NO is field # 14, Offset 78 in-record.

foo.wpt
Record 811: It's raining cheese! Record type not Arc!
Skipping this file.
yakra commented 6 years ago

unsigned int RecordNum = ((unsigned int)DBF.tellg()-HeaderLength)/RecordLength+1; 811 = (DBF.tellg()-545)/114+1 810 = (DBF.tellg()-545)/114 810*114 = DBF.tellg()-545 92340 = DBF.tellg()-545 92885 = DBF.tellg() 0x16AD5 = DBF.tellg() Looks good so far.

561 SHX.seekg(8*(RecordNum-1)+100); --> SHX.seekg(8*810+100); --> SHX.seekg(6580); // 0x19B4 305408 2 = 610816 SHP file at this offset says Record Number = 811. Content Length = 0x68 (104), same as in SHX file. So far so good. Annnd...* Shape Type = 0x17 (23): PolylineM (page 16)

Turns the SHA_LINE_ROUTES_MD_2015 data is saved with integers, not floats. :) No problem, though...

yakra commented 6 years ago

Should be fine to add: points array starts at byte 44 of record, with preceding info being the same. Types that should also be OK: 5 Polygon 13 PolylineZ 15 PolygonZ 23 PolylineM 25 PolygonM

yakra commented 6 years ago

Support for the above shape types added, 20171118c. Successful test on a PolylineZ record:

#################
#_Basic_options_#
#################

InputFile foo.wpt
ShapeRoot /home/yakra/gis/data/ak/ak_nad83/ak_nad83
KeyField OBJECTID
KeyValue 553

####################
#_Advanced_options_#
####################

JctSnap OFF
SegDump ON

Successful test on a Polygon record:

#################
#_Basic_options_#
#################

InputFile foo.wpt
ShapeRoot /home/yakra/gis/data/md/Maryland_Physical_Boundaries__County_Boundaries_Detailed/Maryland_Physical_Boundaries__County_Boundaries_Detailed
KeyField COUNTYNUM
KeyValue 24

####################
#_Advanced_options_#
####################

JctSnap OFF
SegDump ON