Skip to content

Commit 2f1c621

Browse files
committed
fixed postion of output dictionary values, update readme.
1 parent 5d1d25b commit 2f1c621

8 files changed

Lines changed: 55 additions & 55 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Install Geosupport Desktop Edition:
1515

1616
**Windows users:** Ensure you select the correct Geosupport installation that corresponds to the Python interpreter you are using. Ex., Python 32-bit will only work with Geosupport 32-bit.
1717

18-
`python-geosupport` requires certain environmental variables to be set. This should be handled by the Geosupport Desktop installation process. However, if you encounter issues, please check that the `GEOFILES` variable is set to the `fls` directory of your installation and the Geosupport `bin` directory is in the `PATH`.
19-
18+
Additionally, you should check that the following environmental variables are set:
19+
* `GEOFILES` = the `fls` directory of your Geosupport installation. (ex. `C:\Program Files (x86)\Geosupport Desktop Edition\fls\`)
20+
* The Geospport `bin` directory is in the `PATH`. (ex. `C:\Program Files (x86)\Geosupport Desktop Edition\bin`)
2021

2122
**Linux users:** Extract the .zip to a folder of your choice and set the `GEOFILES` and `LD_LIBRARY_PATH` environmental variables of the `fls` and `lib` directories like so:
2223

@@ -96,9 +97,6 @@ $ export LD_LIBRARY_PATH=/var/geosupport/version-17c/lib/
9697

9798
*The `boro` argument can be borough code, borough name or a common borough abbreviation.
9899

99-
100-
*For more information on outputs, see [geosupport/parsers](https://github.com/ishiland/python-geosupport/tree/master/geosupport/parsers).
101-
102100
### Running tests
103101
```
104102
>> python setup.py test

geosupport/parsers/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| 1A | not yet supported |
77
| BL | `bbl` |
88
| BN | `bin` |
9-
| 1B | `address` | `place` |
9+
| 1B | `address` & `place` |
1010
| AP Extended | `address_point` |
1111
| 2W | `intersection` |
1212
| 3 Extended | `street_segment` |
@@ -18,6 +18,4 @@
1818
All geocoding functions return the output items in `all_wa1.py` where indicated. Additionally, each function returns the items in its associated filename.
1919

2020
For more information on NYC Planning Geosupport COW's, see *APPENDIX 13: CHARACTER-ONLY WORK AREA LAYOUTS (COW)*:
21-
https://nycplanning.github.io/Geosupport-UPG/appendices/appendix13/. The documentation from this url was parsed using [bs4](https://www.crummy.com/software/BeautifulSoup/) to create all `python-geosupport` dictionaries w/comments.
22-
23-
21+
https://nycplanning.github.io/Geosupport-UPG/appendices/appendix13/.

geosupport/parsers/func_1B.py

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
def parse_1B(wa2):
3-
return{
2+
return {
43
# Work Area 2 (COW) - Function 1B
54
# "Internal Use": wa2[0:20],
65
"Continuous Parity Indicator/Duplicate Address Indicator": wa2[21],
@@ -18,7 +17,9 @@ def parse_1B(wa2):
1817
"Special Address Generated Record Flag": wa2[118],
1918
"Side of Street Indicator": wa2[119],
2019
"Segment Length in Feet": wa2[120:125],
21-
"Spatial X-Y Coordinates of Address": wa2[125:139],
20+
# "Spatial X-Y Coordinates of Address": wa2[125:139], 09835090199926
21+
"X Coordinate - Address": wa2[125:132],
22+
"Y Coordinate - Address": wa2[132:139],
2223
"Reserved for Possible Z Coordinate": wa2[139:146],
2324
"Community Development Eligibility Indicator": wa2[146],
2425
"Marble Hill/Rikers Island Alternative Borough Flag": wa2[147],
@@ -75,17 +76,19 @@ def parse_1B(wa2):
7576
"BOE LGC Pointer": wa2[308],
7677
"Segment Azimuth": wa2[309:312],
7778
"Segment Orientation": wa2[312],
78-
"SPATIAL COORDINATES OF SEGMENT": wa2[313:355],
79-
"X Coordinate, Low Address End": wa2[313:320],
80-
"Y Coordinate, Low Address End": wa2[320:327],
81-
# "Z Coordinate, Low Address End": wa2[327:334], # Not Implemented
82-
"X Coordinate, High Address End": wa2[334:341],
83-
"Y Coordinate, High Address End": wa2[341:348],
84-
# "Z Coordinate, High Address End": wa2[348:355], # Not Implemented
85-
"SPATIAL COORDINATES OF CENTER OF CURVATURE": wa2[355:376],
86-
"X Coordinate": wa2[355:362],
87-
"Y Coordinate": wa2[362:369],
88-
# "Z Coordinate": wa2[369:376], # Not Implemented
79+
"SPATIAL COORDINATES OF SEGMENT": {
80+
"X Coordinate, Low Address End": wa2[313:320],
81+
"Y Coordinate, Low Address End": wa2[320:327],
82+
# "Z Coordinate, Low Address End": wa2[327:334], # Not Implemented
83+
"X Coordinate, High Address End": wa2[334:341],
84+
"Y Coordinate, High Address End": wa2[341:348],
85+
# "Z Coordinate, High Address End": wa2[348:355], # Not Implemented
86+
},
87+
"SPATIAL COORDINATES OF CENTER OF CURVATURE": {
88+
"X Coordinate": wa2[355:362],
89+
"Y Coordinate": wa2[362:369],
90+
# "Z Coordinate": wa2[369:376], # Not Implemented
91+
},
8992
"Radius of Circle": wa2[376:383],
9093
"Secant Location Related to Curve": wa2[383], # L - Left, R - Right
9194
"Angle to From Node - Beta Value": wa2[384:389], # Beta & Alpha Used to Calculate Coordinates
@@ -159,9 +162,9 @@ def parse_1B(wa2):
159162
"Continuous Parity Indicator / Duplicate Address Indicator": wa2[1521],
160163
"Low House Number of Defining Address Range": wa2[1522:1533], # Sort Format
161164
"BOROUGH BLOCK LOT (BBL)": { # Billing BBL if Condo
162-
"Borough Code": wa2[1533],
163-
"Tax Block": wa2[1534:1539],
164-
"Tax Lot": wa2[1539:1543]},
165+
"Borough Code": wa2[1533],
166+
"Tax Block": wa2[1534:1539],
167+
"Tax Lot": wa2[1539:1543]},
165168
# "Filler for Tax Lot Version Number": wa2[1543], # Not Implemented
166169
"RPAD Self-Check Code (SCC) for BBL": wa2[1544],
167170
# # "Filler": wa2[1545],
@@ -173,7 +176,8 @@ def parse_1B(wa2):
173176
"Vacant Lot Flag": wa2[1557],
174177
"Irregularly-Shaped Lot Flag": wa2[1558],
175178
"Marble Hill/Rikers Island Alternate Borough Flag": wa2[1559],
176-
"List of Geographic Identifiers Overflow Flag": wa2[1560], # When = 'E', there are more than 21 addrs for Fn 1B (based on Fn 1A)
179+
"List of Geographic Identifiers Overflow Flag": wa2[1560],
180+
# When = 'E', there are more than 21 addrs for Fn 1B (based on Fn 1A)
177181
# "STROLLING KEY": wa2[1561:1579], # Not Implemented
178182
"Borough": wa2[1561],
179183
"5-Digit Street Code of ON- Street": wa2[1562:1567],
@@ -195,21 +199,23 @@ def parse_1B(wa2):
195199
# "Filler - Tax Log Version No. of High BBL": wa2[1634], # Not Implemented
196200
# # "Filler": wa2[1635:1649],
197201
"Cooperative ID Number": wa2[1650:1653],
198-
"SBVP (SANBORN MAP IDENTIFIER)": wa2[1654:1662],
202+
"SBVP (SANBORN MAP IDENTIFIER)": {
199203
"Sanborn Borough Code": wa2[1654],
200204
"Volume Number": wa2[1655:1657],
201205
"Volume Number Suffix": wa2[1657],
202206
"Page Number": wa2[1658:1661],
203-
"Page Number Suffix": wa2[1661],
207+
"Page Number Suffix": wa2[1661]
208+
},
204209
"DCP Commercial Study Area": wa2[1662:1667],
205210
"Tax Map Number Section & Volume": wa2[1667:1672],
206211
# "Reserved for Tax Map Page Number": wa2[1672:1675], # Not Implemented
207212
# # "Filler": wa2[1676:1678],
208-
"Latitude - centroid": wa2[1679:1687],
209-
"Longitude - centroid": wa2[1688:1699],
210-
"XCoord - centroid": wa2[1699:1706],
211-
"YCoord - centroid": wa2[1706:1713],
212-
# "X-Y Coordinates of Lot Centroid": wa2[1699:1713],
213+
"Coordinates of Lot Centroid": {
214+
"Latitude": wa2[1679:1687],
215+
"Longitude": wa2[1688:1699],
216+
"X Coordinate": wa2[1699:1706],
217+
"Y Coordinate": wa2[1706:1713],
218+
},
213219
"Business Improvement District (BID)": wa2[1713:1719],
214220
"TPAD BIN Status": wa2[1719], # TPAD Request
215221
"TPAD New BIN": wa2[1720:1727], # TPAD Request
@@ -250,4 +256,4 @@ def parse_1B(wa2):
250256
# "TPAD BIN Status": wa2[49], # TPAD Request
251257
# "Street Name": wa2[50:81],
252258
# "Filler": wa2[82:115]
253-
}
259+
}

geosupport/parsers/func_1_1E.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def parse_1_1E_ext(wa2):
9999
"Radius of Circle": wa2[376:383],
100100
"Secant Location Related to Curve": wa2[383], # L - Left, R - Right
101101
"Angle to From Node - Beta Value": wa2[384:389], # Beta & Alpha Used to Calculate Coordinates
102-
"Angle to To Node Alpha Value": wa2[389:394],
102+
"Angle to To Node - Alpha Value": wa2[389:394],
103103
"From LION Node ID": wa2[394:401], # From Node
104104
"To LION Node ID": wa2[401:408], # To Node
105105
"LION KEY FOR VANITY ADDRESS": {

geosupport/parsers/func_3.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
def parse_3(wa2):
33
# Work Area 2 (COW) - Function 3
4-
54
regular = {
65
# "Internal Use": wa2[0:20],
76
"Duplicate Key Flag or Continuous Parity": wa2[21],
@@ -15,10 +14,10 @@ def parse_3(wa2):
1514
"Number of Cross Streets at High Address End": wa2[61],
1615
"List of Cross Streets at High Address End (Up to five B5SCs, 6 bytes each)": wa2[62:92], # Blank Filled
1716
"Cross Street Reversal Flag": wa2[92],
18-
"LION KEY": wa2[93:103],
17+
"LION KEY": {
1918
"LION Borough Code": wa2[93],
2019
"LION Face Code": wa2[94:98],
21-
"LION Sequence Number": wa2[98:103],
20+
"LION Sequence Number": wa2[98:103]},
2221
"Generated Record Flag": wa2[103],
2322
"Length of Segment in Feet": wa2[104:109],
2423
"Segment Azimuth": wa2[109:112],

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setup(
1515
name='python-geosupport',
16-
version='0.0.8',
16+
version='0.0.9',
1717
url='https://github.com/ishiland/python-geosupport',
1818
description='Python bindings for the NYC Geosupport Desktop application',
1919
long_description="""

tests/test_address.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_address_point(self):
3333
reader = csv.DictReader(csvfile)
3434
for row in reader:
3535
r = g.address_point(house_number=row['BUILDING'], street=row['STREET'], zip=row['ZIPCODE'])
36-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
36+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
3737

3838
def test_street_stretch(self):
3939
with open(street_stretch) as csvfile:
@@ -42,93 +42,93 @@ def test_street_stretch(self):
4242
r = g.street_stretch(row['Street Name'], row['Cross Street 1'], row['Cross Street 2'], row['Borough'],
4343
compass_direction=row['Compass 1'],
4444
compass_direction_2=row['Compass 2'])
45-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
45+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
4646

4747
def test_blockface(self):
4848
with open(blockface) as csvfile:
4949
reader = csv.DictReader(csvfile)
5050
for row in reader:
5151
r = g.blockface(row['Street Name'], row['Cross Street 1'], row['Cross Street 2'], row['Borough'],
5252
compass_direction=row['Compass 1'])
53-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
53+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
5454

5555
def test_street_segment(self):
5656
with open(blockface) as csvfile:
5757
reader = csv.DictReader(csvfile)
5858
for row in reader:
5959
r = g.street_segment(row['Street Name'], row['Cross Street 1'], row['Cross Street 2'], row['Borough'])
60-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
60+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
6161

6262
def test_intersection(self):
6363
with open(cross_streets) as csvfile:
6464
reader = csv.DictReader(csvfile)
6565
for row in reader:
6666
r = g.intersection(row['Intersection Street 1'], row['Intersection Street 2'], row['Borough'])
67-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
67+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
6868

6969
def test_place(self):
7070
with open(placenames) as csvfile:
7171
reader = csv.DictReader(csvfile)
7272
for row in reader:
7373
r = g.place(row['Landmark'], row['Borough'])
74-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
74+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
7575

7676
def test_bin(self):
7777
with open(bbl_bin) as csvfile:
7878
reader = csv.DictReader(csvfile)
7979
for row in reader:
8080
r = g.bin(row['BIN'])
81-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
81+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
8282

8383
def test_bbl(self):
8484
with open(bbl_bin) as csvfile:
8585
reader = csv.DictReader(csvfile)
8686
for row in reader:
8787
r = g.bbl(row['BORO CODE'], row['BLOCK'], row['LOT'])
88-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
88+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
8989

9090
def test_address_parser(self):
9191
with open(address_unparsed) as csvfile:
9292
reader = csv.DictReader(csvfile)
9393
for row in reader:
9494
in_data = row['ADDRESS'] + ', ' + row['CITY'] + ', ' + row['ZIPCODE']
9595
r = g.address(address=in_data)
96-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
96+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
9797

9898
def test_address_parser_with_boroname(self):
9999
with open(address_unparsed) as csvfile:
100100
reader = csv.DictReader(csvfile)
101101
for row in reader:
102102
r = g.address(address=row['ADDRESS'], boro=row['BORO NAME'])
103-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
103+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
104104

105105
def test_address_parser_with_zipcode(self):
106106
with open(address_unparsed) as csvfile:
107107
reader = csv.DictReader(csvfile)
108108
for row in reader:
109109
r = g.address(address=row['ADDRESS'], zip=row['ZIPCODE'])
110-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
110+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
111111

112112
def test_address_with_borocode(self):
113113
with open(address_parsed) as csvfile:
114114
reader = csv.DictReader(csvfile)
115115
for row in reader:
116116
r = g.address(house_number=row['BUILDING'], street=row['STREET'], boro=row['BORO CODE'])
117-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
117+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
118118

119119
def test_address_with_boroname(self):
120120
with open(address_parsed) as csvfile:
121121
reader = csv.DictReader(csvfile)
122122
for row in reader:
123123
r = g.address(house_number=row['BUILDING'], street=row['STREET'], boro=row['BORO'])
124-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
124+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
125125

126126
def test_address_with_zipcode(self):
127127
with open(address_parsed) as csvfile:
128128
reader = csv.DictReader(csvfile)
129129
for row in reader:
130130
r = g.address(house_number=row['BUILDING'], street=row['STREET'], zip=row['ZIPCODE'])
131-
self.assertTrue(int(r['Geosupport Return Code']) == 0)
131+
self.assertTrue(int(r['Geosupport Return Code']) <= 1)
132132

133133

134134
if __name__ == "__main__":

0 commit comments

Comments
 (0)