Ramer Douglas Peucker algorithm applied to list of coordinates: Strings to floats

Viewed 23

I have a list of 466 lat/lon-coordinate pairs as follows:

pos = ['52,13','53,15',....,'54,16']

I would like to apply the RDP algorithm in order to reduce this list to just 8 coordinates.

I am using the following code:

length = len(pos)/2
length = int(length)

b = rdp(a.reshape(length, 2))
print (b)

This yields the following error:

TypeError: unsupported operand type(s) for -: 'str' and 'str'

How to resolve the issue that the items in the array are strings ?

0 Answers
Related