'Converting coordinates to another form, bug fix
I am converting coordinates to another format, but there was an error
longitude = (lon - 4294967295) / 6356752.3142 * (180/math.pi)
unsupported operand type(s) for -: 'list' and 'int'
I will be grateful for advice
Solution 1:[1]
You can't perform a mathematical operation like subtraction on a list AKA an iterable type and an integer. You're trying to do:
[0,1,2,3,..,n] - 4294967295
What you might have meant is:
(lon[i] - 4294967295)
Where i is the index number for whichever value of the list you wanted.
Solution 2:[2]
Try just converting your lon from a list (which doesn't support arithmetic operations like +, -, etc.) to a numpy array (which does support arithmetic operations):
lon = np.array(lon)
longitude = (lon - 4294967295) / 6356752.3142 * (180/math.pi)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jp94 |
| Solution 2 |
