Search code examples
python-3.xgeopy

Vincenty through a list o list


Hello I want to use vincenty from geopy.distance to calculate the distance from a list of list of coordinates.

This is my code:

import geopy 
from geopy.distance import vincenty
x = [[45.4777928, 9.1607807], [45.4625482, 9.1443695], [45.4632698, 9.1977634]]
vincenty(x)

The output error is:

TypeError: unsupported operand type(s) for +=: 'int' and 'list'

Can someone help me?


Solution

  • As I mentioned in comment (don't have geopy myself) you need to unpack the list into arguments using:

    vincentry(*x)