<div dir="ltr">If your data is in a Spatialite or a Postgis database, it's quite easy to achieve what you seek.<div><br></div><div>All you need to do is create a SQL query similar to this one in DB Manager:</div><div><br></div><div><font face="monospace, monospace">SELECT</font></div><div><font face="monospace, monospace">    a.gid as dep_id,</font></div><div><font face="monospace, monospace">    b.gid as dest_id, </font></div><div><font face="monospace, monospace">    ST_Distance(a.geom, b.geom) as distance,</font></div><div><font face="monospace, monospace"><span style="background-color:rgb(255,255,255)">    </span><span style="color:rgb(46,46,46);line-height:16px;background-color:rgb(248,248,249)">ST_MakeLine(a.geom, b.geom) as geom</span></font></div><div><span style="color:rgb(46,46,46);line-height:16px;background-color:rgb(248,248,249)"><font face="monospace, monospace">FROM</font></span></div><div><span style="color:rgb(46,46,46);line-height:16px;background-color:rgb(248,248,249)"><font face="monospace, monospace">    my_table as a, my_table as b</font></span></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">WHERE</span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">    a.gid > b.gid</span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)"><br></span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">Note: This is the postgis version, not sure if the same function applies to spatialite</span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)"><br></span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">Add it to the map canvas by using dep_id as unique value column and geom as geometry column.</span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)"><br></span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">Hope it helps.</span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)"><br></span></font></div><div><font color="#2e2e2e" face="monospace, monospace"><span style="line-height:16px;background-color:rgb(248,248,249)">Alexandre Neto</span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 10, 2015 at 8:08 AM, Raymond Nijssen <span dir="ltr"><<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Joris,<br>
<br>
I dont know about that plugin, but i would write a little script for that like this:<br>
<br>
# get active (point) layer as input<br>
inputlayer = iface.activeLayer()<br>
# create new memory layer for output<br>
outputlayer = QgsVectorLayer("Linestring", "distance_lines", "memory")<br>
outputprovider = outputlayer.dataProvider()<br>
# loop all points<br>
iter = inputlayer.getFeatures()<br>
for feature in iter:<br>
    p1 = feature.geometry().asPoint()<br>
    iter2 = layer.getFeatures()<br>
    for feature2 in iter2:<br>
        p2 = feature2.geometry().asPoint()<br>
        if not p1 == p2:<br>
            # create new line<br>
            l = QgsGeometry.fromPolyline([p1,<u></u>p2])<br>
            feat = QgsFeature()<br>
            feat.setGeometry(l)<br>
            outputprovider.addFeatures([<u></u>feat])<br>
outputlayer.commitChanges()<br>
outputlayer.updateExtents()<br>
# add to map<br>
QgsMapLayerRegistry.instance()<u></u>.addMapLayer(outputlayer)<br>
<br>
Good luck,<br>
<br>
Raymond<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 09-03-15 18:18, Joris Hintjens wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks Raymond, but what I need is the distance from every point in a layer to every other point. That is what “distance matrix” gives me.<br>
Then, I want to plot every distance line (as a seperate layer?) on the map.<br>
<br>
Joris<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Begin doorgestuurd bericht:<br>
<br>
Datum: 9 maart 2015 15:53:56 CET<br>
Van: Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>><br>
Aan: <a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a><br>
Onderwerp: Antw.: [Qgis-user] Visualize Distance matrix<br>
<br>
Hi Joris,<br>
<br>
Not sure if I understand your question, but if you want to do a distance calculation for all points in a point layer to a certain location you can use the field calculator in the attribute table window.<br>
<br>
The expression should be:<br>
<br>
distance($geometry ,geomFromWKT( 'POINT(0 0)' ))<br>
<br>
to calculate all distances to coordinate 0,0.<br>
<br>
Hope this helps you.<br>
<br>
Raymond<br>
<br>
<br>
<br>
On 09-03-15 15:13, Joris Hintjens wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I feel stupid: I am stuck with what seems a basic operation..<br>
I have a points layer, of which I want to visualize the distance matrix.<br>
I can create the martini CSV.<br>
I cannot create a distance hub layer with the MMQGIS plugin with From and To point from within  the same layer.<br>
<br>
Any help on how I ca get this result on my map?<br>
<br>
PoinA——————>PointB<br>
                xxx Meter<br>
<br>
and this for the entire matrix<br>
<br>
<br>
thanks<br>
Joris<br>
______________________________<u></u>_________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-user</a><br>
<br>
</blockquote>
<br>
--<br>
Terglobo<br>
Ampèrestraat 110<br>
5223 CT 's-Hertogenbosch<br>
06-25314983<br>
______________________________<u></u>_________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-user</a><br>
</blockquote>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-user</a><br>
<br>
</blockquote>
<br>
-- <br>
Terglobo<br>
Ampèrestraat 110<br>
5223 CT 's-Hertogenbosch<br>
06-25314983<br>
</div></div><br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div><br></div>