<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 10.00.9200.16540"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial>Jo,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial>ST_ConcaveHull and ST_Collect work on a geometry and you are 
trying to apply it to a record as the error says :)   <FONT 
color=#000000 size=3 face="Times New Roman">ERROR:  function 
st_collect(record) does not exist</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial>PostgreSQL is funny as it allows you to pass around whole 
records to functions so since you did</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN 
class=793171603-24042013>ST_Collect(surroundingstops)</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial>you are passing the record not the geometry.  Try 
changing to</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013>ST_Collect(surroundingstops.geomdl)</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013><FONT color=#0000ff size=2 face=Arial>Hope that 
helps,</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013><FONT color=#0000ff size=2 
face=Arial>Regina</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013><FONT color=#0000ff size=2 face=Arial><A 
href="http://www.postgis.us">http://www.postgis.us</A></FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013><FONT color=#0000ff size=2 face=Arial><A 
href="http://postgis.net">http://postgis.net</A></FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=793171603-24042013><SPAN 
class=793171603-24042013></SPAN></SPAN> </DIV><BR>
<DIV lang=en-us class=OutlookMessageHeader dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> postgis-users-bounces@lists.osgeo.org 
[mailto:postgis-users-bounces@lists.osgeo.org] <B>On Behalf Of 
</B>Jo<BR><B>Sent:</B> Tuesday, April 23, 2013 5:54 AM<BR><B>To:</B> PostGIS 
Users Discussion<BR><B>Subject:</B> [postgis-users] Query to find all stops 
surrounding 1 stop and turn it into a concave hull polygon 
geometry<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>
<DIV>
<DIV>
<DIV>After a lot of trial and error I came up with this query:<BR><BR>SELECT 
ST_ConcaveHull(ST_Collect(surroundingstops),0.98)<BR> FROM (SELECT 
st1.geomdl <BR>        FROM stops 
st1<BR>        WHERE 
ST_DWithin(st1.geomdl::geography, 
<BR>                         
(SELECT 
st2.geomdl<BR>                           
FROM stops 
st2<BR>                           
WHERE 
st2.stopidentifier=203896<BR>                            
AND st1.osm_zone IS NOT 
NULL)::geography,<BR>                          
1000)) surroundingstops;<BR><BR></DIV>Unfortunately I get this error 
message:<BR><BR>ERROR:  function st_collect(record) does not exist<BR>LINE 
1: SELECT 
ST_ConcaveHull(ST_Collect(surroundingstops),0.98)<BR>                              
^<BR>HINT:  No function matches the given name and argument types. You 
might need to add explicit type casts.<BR><BR><BR></DIV>The subquery results in 
1 column of geometry values. When looking at the examples on<BR><BR><A 
href="http://www.bostongis.com/postgis_concavehull.snippet">http://www.bostongis.com/postgis_concavehull.snippet</A><BR><BR>they 
always seem to be working with all the values in the table, but I only want to 
get the shape of some of the stops in the DB, not all 43000 of them. Later on, I 
want to group them by zone. The intention is to determine what zone this stop 
belongs to. If it's surround by stops which all have the same zone information, 
it would be safe to conclude this one is part of that zone. When on a border 
between 2 zones it is not.<BR><BR>Should I create a temporary table to 
accomplish this? I tought ST_ConcaveHull would enable me to go from a collection 
of point geometries to 1 polygon geometry.<BR><BR></DIV>
<DIV>Jo<BR></DIV></DIV></BODY></HTML>