Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
How to get lat and long from geom column in postgres DB

I have a table in postgres DB named "building_footprints".

Please see attached image

Postgres table image

and running below query to table

SELECT row_to_json(fc) FROM (
SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (
    SELECT 'Feature' As type, ST_AsGeoJSON(lg.the_geom)::json As geometry,
    row_to_json((gid, the_geom)) As properties FROM building_footprints As lg
) As f) As fc

Query Result is:

Query Output

I want to convert coordinates value(coordinates":[[[[530500.00039933,545400.008863266],) in to lat/long.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

try this

SELECT id, the_geom , ST_X(the_geom::geometry), ST_Y(the_geom::geometry) FROM building_footprints;

you should have postgis extension installed!

see: https://gis.stackexchange.com/questions/57018/get-lon-lat-values-from-a-geography-data-type-in-postgis

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!