Home > Enterprise >  Is region no longer needed for Distance Matrix calls using Python library?
Is region no longer needed for Distance Matrix calls using Python library?

Time:05-30

Previously I used the code below to call the distance matrix api using they python package googlemaps. The call worked last year 2021 but this year (2022) I get an error message to say

distance_matrix() got an unexpected keyword argument 'region'

If I take out the parameter the function completes but I am concerned that calculations could be less accurate without the region parameter. The https://googlemaps.github.io/google-maps-services-python/docs/index.html still includes the region parameter.

I'm running googlemaps package 2.5.1 on anaconda

Distance_Demo=gDistance.distance_matrix(origins =DemoOrigin,
                                        destinations=DemoDestination,
                                        mode='driving',
                                        units='metric',
                                        region="ie",
                                       departure_time=TimeAsInt,
                                       traffic_model='pessimistic')

Anyone any ideas what could be the issue?

CodePudding user response:

This parameter doesn't exist until googlemaps 3.0, so you may want to update to newer version to use it.

Here is the commit that adds region parameter for your reference.

  • Related