Created
July 21, 2020 20:41
-
-
Save Fauntleroy/b2fb4cc12a93805b942bfb7d306e7790 to your computer and use it in GitHub Desktop.
Onfleet Google Geocoding Doc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem | |
Due new requirements from Google Geocoding API guideline, they are categorizing strictness on the apartment/office buildings. | |
They are now qualified as GEOMETRIC_CENTER. However, due to their own guideline, we can’t accept geometric_center as a valid address. | |
There is some situation with our system that we are in the process of changing but not quite there. | |
Depending on how the address field is sent in. We can tackle this problem using my workaround for now. | |
Here’s a valid address that would used to work: | |
{ | |
"address": { | |
"unparsed": "8729 Graves Ave, Santee, CA, 92071" | |
} | |
} | |
or | |
{ | |
"address": { | |
"apartment": "7B", | |
"unparsed": "8729 Graves Ave, Santee, CA, 92071" | |
} | |
} | |
But now it will give us an error: | |
{ | |
"code": "InvalidContent", | |
"message": { | |
"error": 1000, | |
"message": "The values of one or more parameters are invalid.", | |
"cause": "Geocoding errors found.", | |
"request": "d5e0981e-4231-4cee-9021-aa0108009517", | |
"remoteAddress": "104.248.209.194" | |
} | |
} | |
Proposed solution: | |
Add “apartment” into the unparsed address: | |
{ | |
"address": { | |
"apartment": "Unit <unit_here>", | |
"unparsed": "<street_number> <street_name>, Unit <unit_number_here>, <city>, <state>, <zip_code>, <country>" | |
} | |
} | |
Using above address as an example: | |
{ | |
"address": { | |
"apartment": "7B", | |
"unparsed": "8729 Graves Ave, 7B, Santee, CA, 92071" | |
} | |
} | |
Would give us: | |
{ | |
"id": "qTsztBhZXnZuoSCwMFAdpsxy", | |
"timeCreated": 1595289745000, | |
"timeLastModified": 1595289745736, | |
"location": [ | |
-116.9608389, | |
32.8341528 | |
], | |
"address": { | |
"apartment": "7B", | |
"state": "California", | |
"postalCode": "92071", | |
"number": "8729", | |
"street": "Graves Avenue", | |
"city": "Santee", | |
"country": "United States" | |
}, | |
"notes": "", | |
"metadata": [] | |
} | |
Future consideration | |
Ideally we would like to have each individual address cached, that’s why we keep geocoding records on our end and have a destination endpoint. If you have some sort of cache that you can utilize when making these requests. The new workflow would be | |
Make a destination | |
Get the destination ID from Onfleet | |
Ask the users to verify again if the address is correct. | |
Cache locally with the user’s info | |
And when everything is good, make the destination with the destination ID instead of keep sending a new unparsed address each time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what happens with the new example that came up (Onfleet support emails Sept. 15 2021)
Current code:
https://github.com/meadow/api/pull/1232 :
The definition of these warnings can be found here: https://docs.onfleet.com/reference#destination-address-warnings