Skip to content

Commit 18050b3

Browse files
authored
Merge pull request #3 from docmarionum1/master
Fix for Linux
2 parents 3d9509e + e653e25 commit 18050b3

14 files changed

Lines changed: 111 additions & 97 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Extract the .zip to a folder of your choice and set the `GEOFILES` and `LD_LIBRA
2424

2525
```shell
2626
$ export GEOFILES=/var/geosupport/version-17c/fls
27-
$ export LD_LIBRARY_PATH=/var/geosupport/version-17c/lib/
27+
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/geosupport/version-17c/lib/
2828
```
2929

3030
### Install python-geosupport
@@ -145,6 +145,22 @@ g.help('address')
145145
g.help('input')
146146
```
147147

148+
#### Error Handling
149+
150+
python-geosupport will raise a `GeosupportError` when Geosupport returns an
151+
error code. Sometimes there is more information returned, in which case the
152+
exception will have a `result` dictionary.
153+
154+
```python
155+
from geosupport import GeosupportError
156+
157+
try:
158+
g.get_street_code(borough='MN', street='Wort Street')
159+
except GeosupportError as e:
160+
print(e) # 'WORT STREET' NOT RECOGNIZED. THERE ARE 010 SIMILAR NAMES.
161+
print(e.result['List of Street Names']) # List of suggested alternate names
162+
```
163+
148164
## Development
149165

150166
### Running tests

geosupport/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .geosupport import Geosupport
1+
from .geosupport import Geosupport, GeosupportError

geosupport/function_info/function_info.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function,input,output,description,alt_names,regular,extended,long,long+tpad,links
2-
1,Address or Non-Addressable Place name (NAP),"Block face-level data - Standardized Street Name and Street Code, Address Range, List of Cross Streets, ZIP Code, Community District, Health Area, Health Center District, 1990 Census Tract, 2010 Census Tract and block, Fire Engine or Ladder Company, School District, Police Precinct, Police Patrol Borough, XY Coordinates (based on the State Plane Coordinate System), Hurricane Evacuation Zone.
2+
1,Address or Non-Addressable Place name (NAP),"Block face-level data - Standardized Street Name and Street Code, Address Range, List of Cross Streets, ZIP Code, Community District, Health Area, Health Center District, 1990 Census Tract, 2010 Census Tract and block, Fire Engine or Ladder Company, School District, Police Precinct, Police Patrol Borough, XY Coordinates (based on the State Plane Coordinate System), Hurricane Evacuation Zone.
33
Extended: USPS Preferred City Name, Latitude, Longitude","Function 1 processes an input address or input Non-Addressable Place name (NAP) (see Chapter III.6). When called using two work areas, Function 1 returns information about the blockface containing the input address or NAP. This information includes the cross streets at the two intersections delimiting the blockface, and a set of geographic district identifiers including ZIP code, census tract and community district. Function 1 may be called with the Extended Mode Switch.",,300,1500,,,"https://nycplanning.github.io/Geosupport-UPG/appendices/appendix01/#function-1
44
https://nycplanning.github.io/Geosupport-UPG/appendices/appendix13/#work-area-2-cow-functions-1-1e"
55
1B,Address or NAP,Same as for Function 1E + Property Level Information from Function 1A + Street Names for Cross Streets and Address Lists,"Function 1B processes an input address or input Non-Addressable Place name (NAP) (see Chapter III.6). Function 1B returns information about the blockface as well as information about the tax lot and the building (if any) identified by the input address or NAP. The information that is returned includes the cross streets at the two intersections delimiting the blockface, and a set of geographic district identifiers including ZIP code, census tract and community district. Information about the tax lot and the building (if any) identified by the input address or NAP is also returned. This information includes the Borough, Block, and, Lot (BBL), which is the Department of Finance's (DOF) identifier for the tax lot; the DOF building class code; the number of buildings on the lot; the number of street frontages of the lot; a flag indicating whether the lot is a condominium; and the Building Identification Number (BIN) (see Chapter VI.3) of the building identified by the input address",address,4300,,,,"https://nycplanning.github.io/Geosupport-UPG/appendices/appendix01/#function-1b
@@ -15,7 +15,7 @@ Function 1A normally returns information that is updated on a quarterly basis. U
1515
The regular, long, and extended modes for Function 1A are identical to those for Function BL. Function 1A enables the user to retrieve this information by address, while Function BL enables retrieval by BBL.",,1363,2800,17750,17750,"https://nycplanning.github.io/Geosupport-UPG/appendices/appendix01/#function-1a
1616
https://nycplanning.github.io/Geosupport-UPG/appendices/appendix13/#work-area-2-cow-functions-1a-bl-bn"
1717
1N,Street Name,Standardized Street Name and Street Code,"Function 1N is used to normalize a street name and obtain its street code. Functions 1, 1A and 1E can do this also, but those functions require an input house number. The purpose of Function 1N is to provide a way to process a street name alone, without a house number. Note that since the input to Function 1N is not a specific location along a street, Function 1N does not perform local street name validation.","street_name_to_street_code, get_street_code",,,,,https://nycplanning.github.io/Geosupport-UPG/appendices/appendix01/#function-1n
18-
2,"Pair of Intersecting Streets, Named Intersection, or Node Number","Intersection-Level data - Standardized Street Name and Street Codes, List of Additional Cross Streets, ZIP Code, Community District, Health Area, 1990 and 2000 Census Tract, Fire Districts, School District, Police Precinct, XY Coordinates (based on State Plane Coordinate System), Sanitation District, Health Center District, some Political Geography COW: 2W: Latitude, Longitude, Node IDs and Cross Streets","Function 2 processes an input intersection specified either in terms of an intersection name, or in terms of two streets (and, when necessary, a compass direction), or in terms of a node ID. If two input streets intersect exactly once, the user should not specify an input compass direction. If the two input streets intersect at two distinct locations, a compass direction must be specified; it serves to identify which of the two intersections the user wishes Geosupport to process. Geosupport has the ability to process a pair of input streets that intersect more than twice, only if the user can identify the intersection by its node ID. If the user does not know the node ID, the user may issue Function 2W to find the node ID. Function 2W is basically identical to Function 2 except when streets intersect more than twice, Function 2W will reject the call and return the node IDs and street codes/street names for all the intersections at the various nodes. Function 2 and Function 2W are discussed in detail in Chapter VII.2.
18+
2,"Pair of Intersecting Streets, Named Intersection, or Node Number","Intersection-Level data - Standardized Street Name and Street Codes, List of Additional Cross Streets, ZIP Code, Community District, Health Area, 1990 and 2000 Census Tract, Fire Districts, School District, Police Precinct, XY Coordinates (based on State Plane Coordinate System), Sanitation District, Health Center District, some Political Geography COW: 2W: Latitude, Longitude, Node IDs and Cross Streets","Function 2 processes an input intersection specified either in terms of an intersection name, or in terms of two streets (and, when necessary, a compass direction), or in terms of a node ID. If two input streets intersect exactly once, the user should not specify an input compass direction. If the two input streets intersect at two distinct locations, a compass direction must be specified; it serves to identify which of the two intersections the user wishes Geosupport to process. Geosupport has the ability to process a pair of input streets that intersect more than twice, only if the user can identify the intersection by its node ID. If the user does not know the node ID, the user may issue Function 2W to find the node ID. Function 2W is basically identical to Function 2 except when streets intersect more than twice, Function 2W will reject the call and return the node IDs and street codes/street names for all the intersections at the various nodes. Function 2 and Function 2W are discussed in detail in Chapter VII.2.
1919

2020
When successfully called Function 2 returns information about the input intersection. If there are more than two streets at an intersection, Function 2 accepts any pair of those streets as user input for that intersection. An intersection that lies on a borough boundary can be specified in terms of one street from each borough, by using the input field Borough Code 2, as described in Chapter VII.7.
2121

@@ -32,7 +32,7 @@ The information that Function 2 returns ncludes a list of street codes for all s
3232
Note: If either Street 1 or Street 2 contains an intersection name, then the other input street field may either be left blank or it may contain any street that exists at the given intersection.","intersections, intersection_wide",4000,,,,"https://nycplanning.github.io/Geosupport-UPG/appendices/appendix01/#function-2-and-2w
3333
https://nycplanning.github.io/Geosupport-UPG/appendices/appendix13/#work-area-2-cow-function-2"
3434
3,On Street and a pair of Consecutive Cross Streets,"Segment-level data - Standardized Street Names and Street Codes, Lists of Cross Streets at both ends, and information about both sides of the street, (including ZIP Codes, Community Districts, Health Areas, 1990, 2000 and 2010 Census Tracts, Fire Districts, School Districts, Police Precincts), 'From' and 'To' Nodes, Election District, Assembly District
35-
Extended: Latitude, Longitude, Blockface ID","Function 3 processes street segments and closely related three-street configurations. A street segment is a part of a street (called the 'on' street) between two consecutive cross streets. For example, Madison Avenue (in Manhattan) between East 51st Street and East 52nd Street is a street segment. Madison Avenue between East 51st Street and East 53rd Street is not a street segment, because there is an intervening street, East 52nd Street, between the given cross streets. An exception to the requirement that the input cross streets be consecutive along the 'on' street is the case of a T-intersection: Function 3 accepts as input a street configuration that defines the long blockface of a T-intersection. (For precise definitions of the terms 'three-street configuration', 'street segment', and 'T-intersection', see Chapter VII.3.) A street segment intersecting with or lying on a borough boundary can be specified in terms of streets from both boroughs, by using the input fields Borough Code 2 and Borough Code 3, as described in Chapter VII.7.
35+
Extended: Latitude, Longitude, Blockface ID","Function 3 processes street segments and closely related three-street configurations. A street segment is a part of a street (called the 'on' street) between two consecutive cross streets. For example, Madison Avenue (in Manhattan) between East 51st Street and East 52nd Street is a street segment. Madison Avenue between East 51st Street and East 53rd Street is not a street segment, because there is an intervening street, East 52nd Street, between the given cross streets. An exception to the requirement that the input cross streets be consecutive along the 'on' street is the case of a T-intersection: Function 3 accepts as input a street configuration that defines the long blockface of a T-intersection. (For precise definitions of the terms 'three-street configuration', 'street segment', and 'T-intersection', see Chapter VII.3.) A street segment intersecting with or lying on a borough boundary can be specified in terms of streets from both boroughs, by using the input fields Borough Code 2 and Borough Code 3, as described in Chapter VII.7.
3636
3737
The information returned by a successful Function 3 call includes two lists of street codes for all cross streets at the two intersections defined by the input streets; and geographic area codes for the left and right sides of the street, such as the left and right community districts, ZIP codes, census tracts, etc. 'Left' and 'right' are defined relative to the 'on' street's 'logical direction', which in general is the direction of increasing address. The information also includes two items called the Segment Azimuth and the Segment Orientation that indicate how the street segment is oriented with respect to the points of the compass. Applications can use either of these items to determine compass direction descriptors for the left and right sides of the street. Another item, the Cross Street Reversal Flag, can be used to determine left and right relative to the order in which the input cross streets were specified.
3838

0 commit comments

Comments
 (0)