Skip to main content Link Search Menu Expand Document (external link)

Coordinate Objects

A Coordinate object is the most basic geometric element, describing a point on the surface of the Earth. Most GeoDesk functions accept coordinate values as simple (x,y) tuples, but using Coordinate objects has two advantages: They are more compact, and they convert seamlessly between Mercator projection and longitude/latitude (whereas tuples must use Mercator-projected coordinate values).


Use positional arguments (x/y in Mercator projection) or explicit keywords:

Coordinate(lon=12.42, lat=48.76)      # longitude & latitude (any order)
Coordinate(x=148176372, y=668142957)  # Mercator-projected x/y position
Coordinate(148176372, 668142957)      # (Mercator projection by default)


Creates a single Coordinate or a list with multiple Coordinate objects.

coords can be one of the following:

  • Two individual coordinate values

  • Multiple coordinate pairs (tuples or other sequence type)

  • A sequence of coordinate pairs

  • A sequence of individual coordinate values (interpreted as pairs)

Longitude must be specified before latitude.

lonlat(11.81, 51.23)     # Creates single Coordinate

# The following are equivalent (list of 3 Coordinates)
lonlat((11.81,51.23), (7.44,51.71), (9.25, 52.63))
lonlat([11.81,51.23], [7.44,51.71], [9.25, 52.63])
lonlat([ [11.81,51.23], [7.44,51.71], [9.25, 52.63] ])
lonlat(11.81, 51.23, 7.44, 51.71, 9.25, 52.63)

geodesk.latlon(lat, lon)

Same as lonlat(), except latitude before longitude.

Equality and hashing

Coordinates are equal to a simple tuple that has the same Mercator-projected coordinates:

>>> Coordinate(lon=12.42, lat=48.76) == (148176372, 668142957)

Coordinate objects are hashable and therefore suitable as dictionary keys.



The Mercator-projected x-ordinate.


The Mercator-projected y-ordinate.


The coordinate’s longitude.

The coordinate’s latitude.