[Qgis-user] Detecting node valences

phi73 at gmx.de phi73 at gmx.de
Wed Apr 12 23:36:25 PDT 2017


Hello Martin,

yes you are right.

The terminus „Node valence“ is from topology and is defined as the number of
outgoing and incoming lines by a node.
You are example is correct:
a) a T Intersection has val=3
b) a Cross val = 4
c) a „one-way-street“ the end/starting point has val = 1


So i need to run it of the level of database as i assume.

Thanks for your reply so far.

If somebody knows to do it more „user friendly“ i would be happy to learn it.
I have some rudimentary knowledge of running SQL but last time used 15y ago ;-)

Thanks to all of you. It is a great group to be honest.

Pat


On 13. Apr. 2017, 04:44 +0200, Martin Bain <Martin.Bain at lismore.nsw.gov.au>, wrote:
> Hi Pat,
> I saw your previous question went unanswered.  I’m not familiar with the term valence, I’m guessing you want the number of lines that meet at a point.  If you had like a roads layer then three streets would meet at a T intersection – the node would have a valence of three, for a cross intersection the valence would be four.
>
> I’ll start the ball rolling by offering a possible solution, then maybe some bigger brained folks might give a better way of doing it.
>
> There’s probably a sequence of steps you could do to get your end result, maybe something in the processing toolbox?  Being a bit of a database guy, I reached for the DB Manager and came up with the SQL below which can be loaded as a point layer.  THIS QUERY ASSUMES YOUR LINES ONLY MEET AT THE ENDS, IF ONE LINE INTERSECTS ANOTHER IN THE MIDDLE IT WONT BE COUNTED.
>
> The inner select statement returns a set of points. It is a UNION query of two parts, the first part selects each line’s start point and its X and Y coordinates and the second part does the same for the end point of each line.
>
> The outer select statement groups the matching points together and gives a count.  The last line in the query “HAVING VALENCE>2”  filters out any results with a valence less than three, you can adjust the number for your needs or leave it out altogether and filter the rows in QGIS.
>
> Cheers,
> Martin.
>
> SELECT GEOMX,GEOMY, GEOM, COUNT(*) AS VALENCE
> FROM
> (
> SELECT "LCC_WATER_PIPES"."Namecompon",
> "LCC_WATER_PIPES"."MI_PRINX",start_point(
> "LCC_WATER_PIPES"."geometry") AS GEOM ,
> X(start_point("LCC_WATER_PIPES"."geometry")) AS GEOMX,
> Y(start_point("LCC_WATER_PIPES"."geometry")) AS GEOMY
> FROM "LCC_WATER_PIPES"
> UNION
> SELECT "LCC_WATER_PIPES"."Namecompon",
> "LCC_WATER_PIPES"."MI_PRINX",end_point(
> "LCC_WATER_PIPES"."geometry") AS GEOM ,
> X(end_point("LCC_WATER_PIPES"."geometry")) AS GEOMX,
> Y(end_point("LCC_WATER_PIPES"."geometry")) AS GEOMY
> FROM "LCC_WATER_PIPES"
> )
> GROUP BY GEOMX, GEOMY, GEOM
> HAVING VALENCE>2
>
>
>
>
> select A.MI_PRINX,B.MI_PRINX ,intersectION(A.geometry,B.geometry) AS GEOM
> from LCC_WATER_PIPES as A, LCC_WATER_PIPES as B
> WHERE A.MI_PRINX<>B.MI_PRINX
> AND intersects(A.geometry,B.geometry)=1
>
> From: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of phi73 at gmx.de
> Sent: Wednesday, 12 April 2017 11:03 PM
> To: QGIS User List <qgis-user at lists.osgeo.org>
> Subject: [Qgis-user] Detecting node valences
>
> Hello to all,
>
> is there a way i QGIS to run a select over a map to get
> all the nodes with a specific node valence?
>
> If not i would be happy about a shortchanged reply too :)
>
> thanks
> pat
>
>
> This email is intended for the named recipient only. The information it contains may be confidential. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party or take any action in reliance on it. If you have received this email in error, please contact the sender immediately and delete the message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170413/0c62dc74/attachment.html>


More information about the Qgis-user mailing list