Can someone tell me why this keeps returning degrees instead of meters? I’m transforming the geometry SRID to 32613, which measures in meters. Thanks
SELECT storm_date, hail_size_inches,
ST_Distance(
ST_Transform(geom32613, 32613),
ST_SetSRID(
ST_MakePoint(-104.89907, 39.66643),
32613)
) distance
FROM hail.hail_swaths
WHERE storm_date >= '2021/06/01'
Welcome to SO.
Your problem might be somewhere else.
ST_Distancewith two geometries using the SRS 32613 returns the distance in metres:It also works using
ST_TransformDemo:
db<>fiddleAre you perhaps mixing the order of the coordinate pairs? Remember, it is longitude, latitude, not the other way around. If the geometries are correct, please post a WKT literal from both geometries, so that we can reproduce your environment. Another option would be to use
geographyinstead ofgeometry, which would automatically return the result in metres, but you would need to transform the geometries encoded in 32613 in a lon/lat coordinate system to make the cast work, such as 4326.EDIT: Read carefully the answer of @JGH - he might have found the real issue. You're probably using the coordinates with a wrong SRS!