0

I'm dealing with a database (Teradata) that doesn't have any support for anything other than decimals/decimal degrees. As a result I can't use any of:

  • ST_Area (can't get area in square meters)
  • ST_Buffer (can't specify a distance in meters)
  • ST_Distance (can't get a distance in linear meters)
  • ST_Length (can't get a length in linear meters)

So is there a way to calculate these values in meters within the SQL itself. For example:

SELECT DECIMAL_TO_SQ_METERS(geo_column.ST_Area()))
FROM my_table
7
  • 1
    It's a partial differential equation only resolvable by numerical methods (looping with lots of trigonometric functions and an epsilon value), This is not exactly a SQL strength.
    – Vince
    Commented Jul 10 at 21:00
  • Doesn't sound promising, I guess that's why it's supposed to be supported server side. Commented Jul 10 at 21:24
  • Clients can compute it, but you want a compiled binary doing the work, and for most purposes you want an ST_DWithin to leverage the R-tree index.
    – Vince
    Commented Jul 10 at 23:36
  • If you have a geodetically-aware client library, you could use a worst case conversion of 60nm/degree, and if you want to get fancy, scale the X component by cos(lat_radians). Then use the client to filter results in actual meters.
    – Vince
    Commented Jul 10 at 23:50
  • Look at ST_Transform again. According to the docs you can pass in a WKT string so you may not need to rely on the teradata SRIDs available in your DB. You could then use a UTM or Albers CRS.
    – user2856
    Commented Jul 10 at 23:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.