# [postgis-devel] ST_Area, ST_Area2D

Obe, Regina robe.dnd at cityofboston.gov
Mon Jul 21 04:09:39 PDT 2008

```Mark,

Good point.  That's exactly what I was thinking that if I'm working with
3d data, most of the time if I ask for a ST_Length(..) I expect a 3d
length and 2d I would never expect to get more than 2D, but I wasn't
sure if the specs somehow required ST_Length() should return a 2D length
etc.

Is their a penalty to doing a force_2d() though that would be more
efficiently done with an
ST_Length(geom, [dim])

If so then I would suggest we go with Paul's idea, but instead of
assuming No Dim means 2, that No Dim means the highest dimension (shall
we say -1 so we have only one backend function to contend with).

Thanks,
Regina

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Mark
Cave-Ayland
Sent: Monday, July 21, 2008 5:07 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] ST_Area, ST_Area2D

Paul Ramsey wrote:
> Optional argument? :)
>
> st_length(geom, [dim])
>
> default is 2d regardless of input, [dim] = 3 allows you to get 3d if
> you need it.
>
> P

Hmmm that seems like a lot of extra clutter. My feeling would be that
the result returned should reflect the highest dimension input geometry,

so as Regina suggests would be 2D length for a 2D line or 3D length for
a 3D line. In terms of compliance, anyone inputting 3D geometries is
asking people to add a force_2d() call to switch the result if the 2D
result is what they actually wanted. Common sense would suggest that if
you have a 3D input, you'll get a 3D output.

ATB,

Mark.

--
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended