There is a special tag 'way_area' in osm2pgsql creating a database column that stores the area of polygon features. So is there something like this for calculation of length of line objects?


No, but use can use PostGIS function ST_Length for that. It returns length in meters if way field is of geography type. That is, to get length in meters, convert it: ST_Length(ST_Transform(way, 4326)::geography).

  • It's also worth noting that if you just want to order by length, ST_Length(way) will work if only considering a reasonable sized area as once, assuming you have imported with a conformal projection like Web Mercator – Paul Norman Sep 9 '14 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.