# [postgis-users] Re: maximum distance between a POINT and POLYGON

Obe, Regina robe.dnd at cityofboston.gov
Thu Feb 19 07:29:17 PST 2009

```It hasn't been implemented.  Well it was a long long time ago, but the
logic was incorrect so it was turned off.

We plan to bring it back probably in a 1.4.something or 1.5

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
nicklas.aven at jordogskog.no
Sent: Thursday, February 19, 2009 8:50 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Re: maximum distance between a POINT and
POLYGON

Hallo

What is the problem with ST_Max_Distance(geometry g1, geometry g2)?

/Nicklas

2009-02-19 My Pid wrote:

Hello again,
>
>I found the generate_series function (yes i am a newbie!) and I can use
it in order to calculate the distance between
> my centroid (geometry_centroid) and my polygon (geometry_zone) with
the following request
>
>
>SELECT
(distance_spheroid(geometry_centroid,ST_AsText(ST_PointN(ExteriorRing(ge
ometry_zone), generate_series(1,(SELECT npoints(geometry_zone) FROM
"208_1_26624_zones" WHERE "cellID"='1')))), 'SPHEROID["WGS
84",6378137,298.257223563]')) as d FROM "208_1_26624_zones" WHERE
"cellID"='1';
>
>Now I can't use the max function because of the following error:
"set-valued function called in context that cannot accept a set"
>when I use
>
>SELECT
max(distance_spheroid(geometry_centroid,ST_AsText(ST_PointN(ExteriorRing
(geometry_zone), generate_series(1,(SELECT npoints(geometry_zone) FROM
"208_1_26624_zones" WHERE "cellID"='1')))), 'SPHEROID["WGS
84",6378137,298.257223563]')) as d FROM "208_1_26624_zones" WHERE
"cellID"='1';
>
>
>any idea ?
>
>thanks!
>Nick
>
>
>>
2009/2/18 My Pid <mamat750 at gmail.com>
>Hello,
>
>I would like to know how I could get the maximum distance between a
POINT and a POLYGON.
> (the POINT i am talking about here is in fact the ST_Centroid of the
mentionned POLYGON)
>
>I looked for a function that transform my POLYGON into several POINT
but without success.
>
>I am working with longitude, latitude, altitude for POINT
>It is really the max distance that I am looking for (not the minimum
distance.)
>and "accuracy" is important to me.
>
>
>regards,
>Nick
>
>
>

>

-----------------------------------------
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