liveBook · Manning

Longitude

As explained in Just Use Postgres!

Longitude is the angular coordinate measuring position east or west of the prime meridian on Earth.

Longitude measures a location east or west of the prime meridian. In geospatial SQL, longitude appears in degree-based coordinates, with longitude listed before latitude. section 10.5.1

Use longitude when transforming and publishing point coordinates:

  • Transform projected coordinates to SRID 4326, which represents locations using longitude and latitude. section 10.5.1
  • Extract longitude from a transformed point with ST_X, then pass it to a map URL as the mlon parameter. section 10.5.1

Mapping Tampa's longitude

Transform Tampa's point to degree coordinates, then generate an OpenStreetMap URL. The result is POINT(-82.458444 27.947759499952074), where -82.458444 is longitude; the URL passes it through mlon. section 10.5.1

Listing 10.12 Transforming coordinates to latitude and longitude
SELECT name, ST_AsText(ST_Transform(way, 4326)) AS coordinates 
FROM florida.planet_osm_point
WHERE name = 'Tampa' and place = 'city';

Inspect the SQL that transforms a stored point into longitude-and-latitude coordinates. section 10.5.1

How Just Use Postgres! covers it

How deep it goes
Explains coordinate ordering, SRID transformation, ST_X extraction, and URL construction without deeper coordinate-system theory.
Examples
Demonstrates Tampa's city-center point, transformed coordinates, and an OpenStreetMap marker URL.
What you can do after
Apply it via PostGIS functions to transform points, extract longitude, and generate map links.
How it connects
Connects longitude with latitude, SRID 4326, Web Mercator, ST_Transform, ST_X, and OpenStreetMap URLs.

Also explained in

Compare how 2 books explain longitude →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.