[postgis-users] Query to find all stops surrounding 1 stop and turn it into a concave hull polygon geometry

Jo winfixit at gmail.com
Tue Apr 23 22:55:49 PDT 2013


Hi Regina,

I noticed the mention of record, but I was at a loss of how to solve it.
Now that you told me, I'd say: of course! Why didn't I think of that?
It shows that I don't know all that much about databases... I'm glad though
the combination of PostgreSQL and PostGIS is available for amateurs like
myself to experiment with and to learn from.
Before JOSM was all I needed to be 'productive' with geodata in the context
of Openstreetmap, but since I have this dataset of public transportation
I'm trying to integrate into it, I'm going into new and unexplored waters
little by little.

Many thanks for your help!

Jo


2013/4/24 Paragon Corporation <lr at pcorp.us>

> **
> Jo,
>
> ST_ConcaveHull and ST_Collect work on a geometry and you are trying to
> apply it to a record as the error says :)   ERROR:  function
> st_collect(record) does not exist
>
> PostgreSQL is funny as it allows you to pass around whole records to
> functions so since you did
>
> ST_Collect(surroundingstops)
>
> you are passing the record not the geometry.  Try changing to
>
> ST_Collect(surroundingstops.geomdl)
>
> Hope that helps,
> Regina
> http://www.postgis.us
> http://postgis.net
>
>
>  ------------------------------
> *From:* postgis-users-bounces at lists.osgeo.org [mailto:
> postgis-users-bounces at lists.osgeo.org] *On Behalf Of *Jo
> *Sent:* Tuesday, April 23, 2013 5:54 AM
> *To:* PostGIS Users Discussion
> *Subject:* [postgis-users] Query to find all stops surrounding 1 stop and
> turn it into a concave hull polygon geometry
>
>   After a lot of trial and error I came up with this query:
>
> SELECT ST_ConcaveHull(ST_Collect(surroundingstops),0.98)
>  FROM (SELECT st1.geomdl
>         FROM stops st1
>         WHERE ST_DWithin(st1.geomdl::geography,
>                          (SELECT st2.geomdl
>                            FROM stops st2
>                            WHERE st2.stopidentifier=203896
>                             AND st1.osm_zone IS NOT NULL)::geography,
>                           1000)) surroundingstops;
>
> Unfortunately I get this error message:
>
> ERROR:  function st_collect(record) does not exist
> LINE 1: SELECT ST_ConcaveHull(ST_Collect(surroundingstops),0.98)
>                               ^
> HINT:  No function matches the given name and argument types. You might
> need to add explicit type casts.
>
>
> The subquery results in 1 column of geometry values. When looking at the
> examples on
>
> http://www.bostongis.com/postgis_concavehull.snippet
>
> 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.
>
> 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.
>
> Jo
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130424/a5ef0f8b/attachment.html>


More information about the postgis-users mailing list