ggmap
ggmap copied to clipboard
Mapdist reports error because of Google's max elements per query limit
Hi
I came to realize that google has 100 elements (or lanes) per query limit.
The way mapdist() operates now is it will make single query for all the lanes with same source.
For example :"https://maps.googleapis.com/maps/api/distancematrix/json?origins=60134&destinations=03229%7C73702%7C81082%7C70058%7C27299%7C62205%7C94545%7C43214%7C68127%7C55057%7C98499%7C18434%7C62239%7C30601%7C97470%7C14733%7C38557%7C65738%7C45840%7C76140%7C65582%7C70360%7C68521%7C53037%7C34761%7C66061%7C35040%7C36340%7C27576%7C08085%7C38118%7C06074%7C77060%7C30043%7C76018%7C44087%7C48111%7C60440%7C61201%7C21776%7C68110%7C80111%7C61364%7C58201%7C77032%7C12779%7C53086%7C01581%7C50021%7C97230%7C14001%7C46628%7C75229%7C63020%7C92337%7C95356%7C61611%7C84119%7C62208%7C54751%7C47926%7C44711%7C32310%7C14850%7C12866%7C20855%7C70520%7C53224%7C76111%7C40202%7C04072%7C54603%7C12525%7C01888%7C45237%7C24174%7C06084%7C15349%7C54234%7C25701%7C98362%7C85017%7C49426%7C13220%7C89030%7C10473%7C16066%7C14760%7C89431%7C87113%7C94583%7C33610%7C27603%7C94010%7C95215%7C53704%7C92832%7C32806%7C33179%7C98424%7C24153&key=xxx&mode=driving".
Once the number of destinations is greater than 100 this URL returns error.
I can always pre process such lanes , but I was wondering is there a better solution to such cases.