Hi Joris,

I dont know about that plugin, but i would write a little script for that like this:

# get active (point) layer as input
inputlayer = iface.activeLayer()
# create new memory layer for output
outputlayer = QgsVectorLayer("Linestring", "distance_lines", "memory")
outputprovider = outputlayer.dataProvider()
# loop all points
iter = inputlayer.getFeatures()
for feature in iter:
    p1 = feature.geometry().asPoint()
    iter2 = layer.getFeatures()
    for feature2 in iter2:
        p2 = feature2.geometry().asPoint()
        if not p1 == p2:
            # create new line
            l = QgsGeometry.fromPolyline([p1,p2])
            feat = QgsFeature()
            feat.setGeometry(l)
            outputprovider.addFeatures([feat])
outputlayer.commitChanges()
outputlayer.updateExtents()
# add to map
QgsMapLayerRegistry.instance().addMapLayer(outputlayer)

Good luck,

Raymond


On 09-03-15 18:18, Joris Hintjens wrote:
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.
Then, I want to plot every distance line (as a seperate layer?) on the map.

Joris

Begin doorgestuurd bericht:

Datum: 9 maart 2015 15:53:56 CET
Van: Raymond Nijssen <r.nijs...@terglobo.nl>
Aan: qgis-user@lists.osgeo.org
Onderwerp: Antw.: [Qgis-user] Visualize Distance matrix

Hi Joris,

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.

The expression should be:

distance($geometry ,geomFromWKT( 'POINT(0 0)' ))

to calculate all distances to coordinate 0,0.

Hope this helps you.

Raymond



On 09-03-15 15:13, Joris Hintjens wrote:
I feel stupid: I am stuck with what seems a basic operation..
I have a points layer, of which I want to visualize the distance matrix.
I can create the martini CSV.
I cannot create a distance hub layer with the MMQGIS plugin with From and To 
point from within  the same layer.

Any help on how I ca get this result on my map?

PoinA——————>PointB
                xxx Meter

and this for the entire matrix


thanks
Joris
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


--
Terglobo
Ampèrestraat 110
5223 CT 's-Hertogenbosch
06-25314983
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user




_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


--
Terglobo
Ampèrestraat 110
5223 CT 's-Hertogenbosch
06-25314983
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to