4

I have a postgis table of multilineZM features. I need to divide them into lines of same length (eg 1000 meters). I am new to QGIS and PostGIS (I usually use ArcGIS and ArcObjects). I found in the documentation of QGIS the function QgsGeometry::locateBetweenMeasures but it seems doesn't work with M coord. There is a similar function in PostGIS: ST_LocateBetween that works with M but I don't know how to use it with python QGIS. I tried to define a View in postgres, but DBManager says it's not a valid layer (the same query in postgres sql editor works).

The query is:

SELECT
    myTable.gid,
    st_locatebetween(myTable.geom, 0::double precision, 500::double precision)
AS
    myNewTable
FROM
    myTable
WHERE
    myTable.gid = 19633;
1

Your query layer needs the unique id defined (gid in your case) in QGIS which you can do in the "Add Postgis Tables" dialog. You need to select from the drop down fields which field is your unique ID, as this is a view. If you haven't done this QGIS may not be able to display your view

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.