0

I am playing around with a map of bike lanes (so, lines) and trying to calculate the total number of miles of lane in each of a couple of regions. But I'm not even sure how to use ST_Length to calculate miles. I'm getting values of .001 and I don't even know what that means.

The documentation: https://postgis.net/docs/ST_Length.html is confusing to me -- I think this is supposed to be giving me meters, but I'm not entirely sure, and the segments tend to be one or tow blocks long, so ... more than .001 meters.

How can I use ST_Length to calculate miles?

Mike T
  • 42,095
  • 10
  • 126
  • 187
Amanda
  • 675
  • 7
  • 22

1 Answers1

2

Are you in the USA?

If so, determine the State Plane coordinate system that is used by your area, and what the SRID is, for example, What is my State Plane zone in Colorado?

I suggest using State Plane as the units are FEET, which can easily be converted to miles.

I use SRID/EPSG:2877

So now use an ST_Transform statement which will project your data 'on the fly' into feet:

ST_Length(ST_Transform(geom, 2877)) 

Now wrap that in a conversion to miles (divide by 5280):

(ST_Length(ST_Transform(geom, 2877))/5280)

and you should have length in miles!

DPSSpatial_BoycottingGISSE
  • 18,790
  • 4
  • 66
  • 110