I need to store some Place IDs in my DB. Unfortunately there is no documentation on the Place ID format. Basically, I mean the maximum (or fixed) length and the valid characters (i.e. a regular expression to validate the formal correctness of a Place ID). In other words, I need to know if I have to use CHAR(n) or VARCHAR(n) and an appropriate check constraint for the column.
It looks like they always are 27 chars of the urlsafe Base64 alphabet (-
instead of +
and _
instead of /
), but I can't be 100% sure as this aspect is not documented.
Can someone shed some light on this?
PLACE_ID's should be a minimum of 512 in a SQL structure.
Here is a valid ID at 315 length: 'EsIBS0FWLjc2LTc4LCBJbmRvZm9vZCBUb3dlciwgU3VkaXJtYW4gUGxhemEsIEpsLiBKZW5kLiBTdWRpcm1hbiBOby43Ni03OCwgUlQuMy9SVy4zLCBLdW5pbmdhbiwgU2V0aWEgQnVkaSwgS2VjYW1hdGFuIFNldGlhYnVkaSwgS290YSBKYWthcnRhIFNlbGF0YW4sIERhZXJhaCBLaHVzdXMgSWJ1a290YSBKYWthcnRhIDEwMjUwLCBJbmRvbmVzaWEiJRojChYKFAoSCSH20UED9GkuEc707mF-vRHxEglLQVYuNzYtNzg'
Personally I use a SHA256 fixed length unique field for PLACE_ID's with a lookup table. Either way, 512 minimum.
Mark
The current documentation (last update 20th of June 2019) states that the place ID varies in length and can (currently) span from 27 characters long all the way to 60.
A place ID is a textual identifier that uniquely identifies a place. The length of the identifier may vary. Examples:
ChIJrTLr-GyuEmsRBfy61i59si0
EisxMyBNYXJrZXQgU3RyZWV0LCBXaWxtaW5ndG9uLCBOQyAyODQwMSwgVVNB
Unfortunately I can't provide you with documentation on PlaceID - I'd love to see some if Google ever nails it down. I do want to note that current PlaceIDs are 40 characters long right now, not 27.
My advice to you (and the advice I take in my own db) is to not limit the size of your PlaceID field and to use Nvarchar to maximize the characters that Google may choose to use in the future.
Since Google isn't committing to any restrictions at the moment, I think that you would be taking a risk assuming they will keep with the current format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With