Skip to content
Advertisement

Python, convert coordinate degrees to decimal points

I have a list of latitude and longitude as follows:

JavaScript

I need to convert it to floats [33.0595, -101.0528].

Sure, the ‘-‘ is the only difference, but it changes when changing hemispheres, which is why a library would be ideal, but I can’t find one.

Advertisement

Answer

You can wrap the following code in a function and use it:

JavaScript

The result match what you expect.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement