<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=383143616-20022009><FONT face=Courier size=2>From your initial
approach, the following should work. I don't use spheroid projections, so this
was only tested with st_distance. I fudged in the distance_spheroid. You may
also want to replace the st_centroid function with your field
"geometry_centroid".</FONT></SPAN></DIV>
<DIV><SPAN class=383143616-20022009><FONT face=Courier
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383143616-20022009><FONT face=Courier size=2>select
max(myDistance) FROM <BR>(<BR> SELECT
distance_spheroid(<BR>
st_centroid(geometry_zone),<BR> ST_PointN(ST_ExteriorRing(geometry_zone), <BR> generate_series(1,st_npoints(ST_ExteriorRing(geometry_zone)))<BR>
,'SPHEROID["WGS 84",6378137,298.257223563]'<BR> ) as
myDistance<BR> from "208_1_26624_zones"<BR>) as
table01</FONT></SPAN></DIV>
<DIV><SPAN class=383143616-20022009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=383143616-20022009><FONT face=Arial color=#0000ff
size=2> </DIV>
<DIV><BR></DIV></FONT></SPAN>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>My
Pid<BR><B>Sent:</B> Thursday, February 19, 2009 4:14 AM<BR><B>To:</B>
postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] Re:
maximum distance between a POINT and POLYGON<BR><BR></FONT></DIV>Hello
again,<BR><BR>I found the generate_series function (yes i am a newbie!) and I
can use it in order to calculate the distance between<BR> my centroid
(geometry_centroid) and my polygon (geometry_zone) with the following
request<BR><BR><BR>SELECT
(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';<BR><BR>Now I can't use the max
function because of the following error: "set-valued function called in
context that cannot accept a set"<BR>when I use<BR><BR>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';<BR><BR><BR>any idea
?<BR><BR>thanks!<BR>Nick<BR><BR><BR>
<DIV class=gmail_quote>2009/2/18 My Pid <SPAN dir=ltr><<A
href="mailto:mamat750@gmail.com"
target=_blank>mamat750@gmail.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hello,<BR><BR>I
would like to know how I could get the maximum distance between a POINT and
a POLYGON.<BR>(the POINT i am talking about here is in fact the ST_Centroid
of the mentionned POLYGON)<BR><BR>I looked for a function that transform my
POLYGON into several POINT but without success.<BR><BR>I am working with
longitude, latitude, altitude for POINT<BR>It is really the max distance
that I am looking for (not the minimum distance.)<BR>and "accuracy" is
important to me.<BR><BR>thanks in advance for your help
!<BR><BR>regards,<BR>Nick<BR><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>