[postgis-users] flow analysis

Nicolas Ribot nicolas.ribot at gmail.com
Thu May 16 05:31:28 PDT 2013


Are they all multilinestrings ?

What gives :
select distinct geometryType(geom) from l4_3

If it is only Linestrings, then you can update your table:
update l4_3 set geom = st_geometryN(geom);

(If you have constraint on the geoemtry's type, you should use an "alter
table..." construct to change the geometry type)

Nicolas


On 16 May 2013 14:03, Hugues François <hugues.francois at irstea.fr> wrote:

> **
> Hello,
>
> You may try to work with a dump of your multi into single
> (st_dump(geom)).geom
>
> Hugues.
>
>
>
>  ------------------------------
> *From:* postgis-users-bounces at lists.osgeo.org [mailto:
> postgis-users-bounces at lists.osgeo.org] *On Behalf Of *Jonatan Malaver
> *Sent:* Thursday, May 16, 2013 2:01 PM
>
> *To:* PostGIS Users Discussion
> *Subject:* Re: [postgis-users] flow analysis
>
>  OK, so after some research I found out that ST_StartPoint() returns NULL
> for multilinestring. Anyone know a work around?****
>
> ** **
>
> Thanks,****
>
> ** **
>
> Jonatan****
>
> ** **
>
> *From:* postgis-users-bounces at lists.osgeo.org [mailto:
> postgis-users-bounces at lists.osgeo.org] *On Behalf Of *Jonatan Malaver
> *Sent:* Thursday, May 16, 2013 7:46 AM
> *To:* PostGIS Users Discussion
> *Subject:* Re: [postgis-users] flow analysis****
>
> ** **
>
> Here’s my query****
>
> WITH RECURSIVE flow(gid, geom) AS (****
>
>     SELECT gid, geom FROM l4_3 WHERE gid = 212****
>
>   UNION ALL****
>
>     SELECT n.gid, n.geom****
>
>     FROM l4_3 n, flow f****
>
>     WHERE ST_DWithin(ST_EndPoint(f.geom),ST_StartPoint(n.geom),0.01)****
>
>   )****
>
> SELECT gid, ST_AsText(geom)****
>
> FROM flow;****
>
> ** **
>
> Here’s the result****
>
> 212;"MULTILINESTRING((589700.21 2926252.04,589698.873744219
> 2926256.62316697))"****
>
> ** **
>
> l4_3 is a multilinestring of and electrical circuit. I would like to see
> what’s downstream the grid from a transformer, fuse, or upstream from a
> house meter.****
>
> ** **
>
> Thanks,****
>
> ** **
>
> Jonatan ****
>
> ** **
>
> *From:* postgis-users-bounces at lists.osgeo.org [
> mailto:postgis-users-bounces at lists.osgeo.org<postgis-users-bounces at lists.osgeo.org>]
> *On Behalf Of *Nicolas Ribot
> *Sent:* Wednesday, May 15, 2013 12:55 PM
> *To:* PostGIS Users Discussion
> *Subject:* Re: [postgis-users] flow analysis****
>
> ** **
>
> Hello,****
>
> ** **
>
> This precise example, no, but the "WITH RECURSIVE" construct yes.****
>
> ** **
>
> Could you post your query and the data model ?****
>
> ** **
>
> Nicolas****
>
> ** **
>
> On 15 May 2013 17:56, Jonatan Malaver <jon.malaver at shrewsburyma.gov>
> wrote:****
>
>  Hello again, ****
>
> I tried the example, but it only returns the same line. Has anyone tried
> that example?****
>
>  ****
>
> Thanks,****
>
>  ****
>
> Jonatan ****
>
>  ****
>
> *From:* postgis-users-bounces at lists.osgeo.org [mailto:
> postgis-users-bounces at lists.osgeo.org] *On Behalf Of *Nicolas Ribot
> *Sent:* Tuesday, May 14, 2013 1:02 PM
> *To:* PostGIS Users Discussion****
>
>
> *Subject:* Re: [postgis-users] flow analysis****
>
>  ****
>
> Hi,****
>
>  ****
>
> The WITH RECURSIVE construct allows to walk a graph:****
>
>  ****
>
> This link may help:****
>
> http://blog.cleverelephant.ca/2010/07/network-walking-in-postgis.html****
>
>  ****
>
> Nicolas****
>
>  ****
>
> On 14 May 2013 18:40, Jonatan Malaver <jon.malaver at shrewsburyma.gov>
> wrote:****
>
>  Hello, is it possible to do any flow analysis? For example, query
> postgis for what down flow a certain point?****
>
>  ****
>
> Thanks,****
>
>  ****
>
> Jonatan Malaver****
>
>  ****
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users****
>
>  ****
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users****
>
> ** **
>
> _______________________________________________
> 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/20130516/8feb618e/attachment.html>


More information about the postgis-users mailing list