Skip to content

Commit a0f127b

Browse files
committed
Error check for minimal field length
1 parent fb69dc6 commit a0f127b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Use the tool box in ArcGIS Pro. There is built in help in the tool metadata, and
2727
This tool has been done in rush. Though is works, it does not match my standards or the industry standards in terms of unit testing or documentation.
2828
If you want to help, or have any suggestion, log an issue, and a pull request if you feel bold enough.
2929

30+
# Data Considerations
3031

32+
Your input feature class must be using Lat / Long, on the spheroid WGS84. The wkid associated with that spatial reference system is 4326. The tool will send you a friendly error message otherwise.
3133

34+
The tool expect a field to populate in your input feature class. That field must be of type string. Its length must be longer than the number of characters request for the plus length + 1. This is because Plus Code will add an extra character '+' after the 8th character. The minimum field length must be 9. This is because even if you ask for a Plus Code encoded on 4 characters, the API still returns 9 characters: for example `86JW0000+`. I have not figured out if that's good or bad yet.
3235

scripts/gp_open_location_geocode.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ def validate_code_field_length(feature_class, plus_code_field, code_length):
3737
field = fields[0]
3838
if field.type != 'String':
3939
raise Exception('The field for plus code must be of type String')
40+
41+
if field.length < 9:
42+
raise Exception('The field {} must at the minimum have a length of 9'.format(plus_code_field))
43+
4044
if field.length < (code_length + 1):
4145
raise Exception('The field {} is not long enough. Field Length: {} - Plus Code Length: {} - Plus Code Length Required: {}'.format(
4246
field.name,

0 commit comments

Comments
 (0)