Hi Nicola,

The first and last segments usually have beg and end fields value not a multiple of 1000.
I.e. begin = 576 m, end 1000 m or begin 76200 m, end 76234 m
This is ok, and ogrlineref correctly woks with this case.

I think, that you can try to play with your data without equal parts sizes. But ogrlineref need - beg (double), end(double) and scale (double) fields.
Scale - is spatial length of you part divided on linear lenght.
I.e. scale = part.get_Length() / (end - beg)

Best regards,
    Dmitry

07.06.2016 18:25, Nicola Baraldo (ICONSULTING) пишет:

Hi Dmitry,

thank you for you response. There is a way to do the step 2 using GDAL?

Moreover, if the path lengths are not multiple of the split size (e.g. 1000m), how the last segment is handled?

Best regards,

Nicola

*Da:*gdal-dev [mailto:gdal-dev-boun...@lists.osgeo.org] *Per conto di *Dmitry Baryshnikov
*Inviato:* martedì 7 giugno 2016 16:16
*A:* gdal-dev@lists.osgeo.org
*Oggetto:* Re: [gdal-dev] Problem using ogrlineref

Hi Nicola,

The idea of ogrlineref was follow:
1. You have layer with some lines and some reper points with known linear coordinates 2. The reper points divide lines on equal parts (e.i. 1000 m) - this is important that parts should be equal 3. The result file will have special structure (required fields: beg, end, scale, and some optional) 4. During referencing ogrlineref make attribute query and get needed part based on beg and end fields (which is rather fast), and than calc point position inside this part.

In your case, the simple way is to extract begin and end point of your lines and make them reper points. After that all steps are usual.

There is no sense to move other fields into the parts file from your original datasource. But you can use -lf option to store some value and use it in future for join with your original data.

Best regards,
     Dmitry

07.06.2016 15:19, Nicola Baraldo (ICONSULTING) пишет:

    Hi guys,

    I am trying to split some routes into segments of the same length
    (dynamic segmentation) using ogrlineref command.

    My data is stored in a shapefile containing a set of paths, for
    each path I know the length in meters.

    I have tried ogrlineref with –create, –get_coord and - get_subline.

    For the first option I don’t have a reper datasource to provide
    because I don’t have mile-stones, are they really necessaries?

    The second and third options give me the following error for each
    path contained in the input shapefile; with –get_coord I have
    tried both options “–m 0” and “–m 1000”, with –get_subline I have
    tried “-mb 0 -me 1” options.



    Can someone help me using this command? Is there a better way to
    perform dynamic segmentation using GDAL?

    Moreover my shapefile contains also a lot of other fields, there
    is a way to keep these information also in the output file?

    Thanks,

    Nicola



    _______________________________________________

    gdal-dev mailing list

    gdal-dev@lists.osgeo.org <mailto:gdal-dev@lists.osgeo.org>

    http://lists.osgeo.org/mailman/listinfo/gdal-dev



_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to