Brief report:
New dbfread.m works well with old shaperead.m :)
New shaperead.m adds underscores to .dbf attributes :(
A "bad" attribute name does not trigger an error message if one valid .dbf attribute appears in the list.
Detailed report follows.
I ran three examples using different attribute lists:
Example Attribute list
1 {"X","GEOID10","BoundingBox","Y","foobar"}
2 {"GEOID10"}
3 {"foobar","X","Y"}
>>>>> First, I replaced both shaperead.m and dbfread.m:
+verbatim+
octave:195> attr={"X","GEOID10","BoundingBox","Y","foobar"};
octave:196> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
_GEOID10_
octave:197> attr={"GEOID10"};
octave:198> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
_GEOID10_
octave:199> attr={"foobar","X","Y"};
octave:200> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
shaperead: file /home/maier/bob/IRC/CENSUS/tl_2019_04_tabblock10.dbf couldn't be read;
no attributes appended
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
-verbatim-
Notes:
Functionality was correct in each example.
Underscores were prepended and appended to the .dbf attribute.
dbfread issues a warning in example 3 but not in example 1.
>>>>>> Then, I used the original shaperead.m and the new dbfread.m:
+verbatim+
octave:209> attr={"X","GEOID10","BoundingBox","Y","foobar"};
octave:210> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
GEOID10
octave:211> attr={"GEOID10"};
octave:212> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
GEOID10
octave:213> attr={"foobar","X","Y"};
octave:214> bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
shaperead: file /home/maier/bob/IRC/CENSUS/tl_2019_04_tabblock10.dbf couldn't be read;
no attributes appended
bl =
8x1 struct array containing the fields:
Geometry
BoundingBox
X
Y
-verbatim-
Notes:
Functionality was correct in each example.
No underscores.
dbfread issues a warning in example 3 but not in example 1.
Code:
attr={"X","GEOID10","BoundingBox","Y","foobar"};
bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
attr={"GEOID10"};
bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
attr={"foobar","X","Y"};
bl = shaperead(BLNAME,"BoundingBox",ds.BoundingBox,"Attributes",attr,"Recordnumbers",[1:1000:150000])
Let me know if you would like to repeat these tests or try a different example. Thanks!