Points along geometry

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Points along geometry

elisenda montaner
Hi all, 

I'm trying to create points along lines using the tool 'points along geometry'. 
I would like to use different distances for each line at start/end point which I have a column with this data in the attributes.
 Is this possible with this tool? I've tried it and it doesn't seem to work. 

Any help would be appreciated. Thanks

Elisenda

_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: Points along geometry

Raymond Nijssen
Hi Elisenda,

I'm afraid you need a bit of python script to do so, since the algorithm
dialog does not have an expression input button for the distance field.

Should go something like this:


inputLayer = iface.activeLayer()

for feat in inputLayer.getFeatures():
     dist = feat['DIST'] # field name with distances
     geom = feat.geometry()
     l = 0
     while l < geom.length():
        p = geom.interpolate(l)
        print(p)
        l += dist


Hope this helps,
Raymond


On 11-06-19 12:15, elisenda montaner wrote:

> Hi all,
>
> I'm trying to create points along lines using the tool 'points along
> geometry'.
> I would like to use different distances for each line at start/end point
> which I have a column with this data in the attributes.
>   Is this possible with this tool? I've tried it and it doesn't seem to
> work.
>
> Any help would be appreciated. Thanks
>
> Elisenda
>
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: Points along geometry

elisenda montaner
Thanks for your suggestion but Unfortunately, I'm a beginner with python or Qpy so it'll take me time to find out how to write the script. 

Regards


On Tue, 11 Jun 2019 20:50 Raymond Nijssen, <[hidden email]> wrote:
Hi Elisenda,

I'm afraid you need a bit of python script to do so, since the algorithm
dialog does not have an expression input button for the distance field.

Should go something like this:


inputLayer = iface.activeLayer()

for feat in inputLayer.getFeatures():
     dist = feat['DIST'] # field name with distances
     geom = feat.geometry()
     l = 0
     while l < geom.length():
        p = geom.interpolate(l)
        print(p)
        l += dist


Hope this helps,
Raymond


On 11-06-19 12:15, elisenda montaner wrote:
> Hi all,
>
> I'm trying to create points along lines using the tool 'points along
> geometry'.
> I would like to use different distances for each line at start/end point
> which I have a column with this data in the attributes.
>   Is this possible with this tool? I've tried it and it doesn't seem to
> work.
>
> Any help would be appreciated. Thanks
>
> Elisenda
>
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user