Skip to main content

Code for parsing lat-long coordinates in “various” formats

Note: perhaps it would be better to integrate this with a more full featured lib like:

https://pypi.python.org/pypi/LatLon23

But that one does not seem to support parsing unknown formats at this point – and it’s GPL, and perhaps a littel more complex and structured than it needs to be.

Formats supported:

Decimal degrees (easy):

23.43
-45.21

Decimal Degrees with quadrant:

23.43 N
45.21 W

Degrees, decimal minutes: (now it starts getting tricky!):

23° 25.800'
-45° 12.600'

or:

23 25.800'
-45 12.600'

or:

23° 25.8' N
45° 12.6' W

Degrees, Minutes, Seconds: (really fun!!!):

 23° 25' 48.0"
-45° 12' 36.0"

or:

 23d 25' 48.0"
-45d 12' 36.0"

or:

23° 25' 48.0" N
45° 12' 36.0" S

or – lots of other combinations!

Adding to the options:

This uses a pretty “stupid” algorithm – it assumes that all formats will be something like:

degrees [separator] minutes [separator] seconds [separtor] [N|S|E|W]

But that actually is pretty darn robust!

If you have other formats you want to be able to parse, please contribute tests! – And ideally a patch if the current code doens’t work.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lat_lon_parser-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file lat_lon_parser-0.1.0.tar.gz.

File metadata

  • Download URL: lat_lon_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for lat_lon_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f2cce5e65cc505980107b2fab5d350cf7e1e9cb60d6a98780604e7bd48c5db1
MD5 c1498af8aeba0b1570b52cfd72ceafc5
BLAKE2b-256 158f9ab631b7651385913de4ae8bcb0277bde7e3996004f13c5595d6dd7751f4

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.3

2 files

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

1 file

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page