6

Given a point in EPSG:4326 I need to know how many degrees (approx) 1 meter is at this location using PostGIS. Feels like http://postgis.net/docs/manual-2.1/ST_Line_Interpolate_Point.html is useful here but I cannot figure it out.

Another way to phrase this question is: What is one point (X) here that would give me 1 meter back when running the following query?

  ST_Distance(
   'SRID=4326;POINT(Input point)'::geography,
   'SRID=4326;POINT(X)'::geography) AS geography_distance
   ;

I would happily accept a point in any direction.

Here is the same question but using "FME's Tester" Converting 1 meter to decimal degrees using FME

TomazicM
  • 25,601
  • 22
  • 29
  • 39
Sebastian
  • 163
  • 3

1 Answers1

5

You can execute the following query, you can modify coordinates in CTE start_coords :

WITH start_coords AS (SELECT 5 AS long, 40 AS lat),
start_point AS (SELECT *, ST_MakePoint(long, lat)::geography AS geog FROM start_coords)

SELECT sp.lat, sp.long, ST_Distance( sp.geog, ST_MakePoint(sp.long, sp.lat + 1)::geography ) AS one_deg_lat_north, -- in meters 1 / ST_Distance( sp.geog, ST_MakePoint(sp.long, sp.lat + 1)::geography ) AS one_meter_lat_north, -- in degrees ST_Distance( sp.geog, ST_MakePoint(sp.long, sp.lat - 1)::geography ) AS one_deg_lat_south, -- in meters 1 / ST_Distance( sp.geog, ST_MakePoint(sp.long, sp.lat - 1)::geography ) AS one_meter_lat_south, -- in degrees ST_Distance( sp.geog, ST_MakePoint(sp.long + 1, sp.lat)::geography ) AS one_deg_long_east, -- in meters 1 / ST_Distance( sp.geog, ST_MakePoint(sp.long + 1, sp.lat)::geography ) AS one_meter_long_east, -- in degrees ST_Distance( sp.geog, ST_MakePoint(sp.long - 1, sp.lat)::geography ) AS one_deg_long_west, -- in meters 1 / ST_Distance( sp.geog, ST_MakePoint(sp.long - 1, sp.lat)::geography ) AS one_meter_long_west -- in degrees FROM start_point sp ;

J. Monticolo
  • 15,695
  • 1
  • 29
  • 64
  • ST_MakePoint(sp.long, sp.lat + 1)::geography <-- This is not corresponding to 1 meter right? I do not think this solution is correct – Sebastian Apr 29 '22 at 09:09
  • 2
    Look at the entire code, the part you mention is to compute, from the coordinates of the original point, a new geography point with an additionnal degree for the latitude. Then it compute the distance between the original point and this new point to get the number of meters for 1 degree, so 1 degree / number of meters gives you the number of degrees for 1 meter, see the SQL comments for the unit. – J. Monticolo Apr 29 '22 at 09:14
  • Thats smart. Why did I not think of this – Sebastian Apr 29 '22 at 09:22