[Qgis-user] Clipping tool takes a lot of time

Jonas Sjögren jonas.sjo at gmail.com
Sun Oct 19 12:13:28 PDT 2014


Hi,
I have just solved the clipping by using v.overlay which gave reasonable
processing time. My experience is that qgis:clip and qgis:difference is
quite slow when it comes to clipping lines by polygon.
Best regards,
Jonas

2014-10-16 11:29 GMT+02:00 Filipe Dias <filipesdias at gmail.com>:

> Yes, convert format is based on ogr2ogr but I dont think it can be
> modified to do "clip". Why don't you try running ogr2ogr from the command
> line?
>
> You need to navigate to the directory where both your shapefiles are
> stored and run the code just like in the blog post. I tried on Linux but it
> should be the same on Windows (command line on Windows is "command prompt").
>
> ogr2ogr -clipsrc clipping_polygon.shp output.shp input.shp
>
> Hope it helps
>
> PS: It would be nice to add a "clip" algorithm based on ogr2og with -clipsrc
> since it seems to be much faster
>
> On Thu, Oct 16, 2014 at 1:16 AM, Jonas Sjögren <jonas.sjo at gmail.com>
> wrote:
>
>> Hi again,
>> unfortunately the processing is quite slow again with the difference
>> algorithm, about 2,5 hours. With a script running with 60 iterations the
>> total processing time will be about a week. No other processes are running
>> except for internet. The script sequence is
>> processing.runalg( 'qgis:difference', InputRoadNetwork, ClippingPolygon,
>> OutputRoadNetwork )
>> I have tried the 'gdalogr:ogr2ogr' clipping algorithm expressed in
>> http://darrencope.com/2011/03/31/clipping-large-shapefiles-using-ogr/
>>  and http://www.gdal.org/ogr2ogr.html
>> which I believe corresponds to the algorithm GDAL/OGR [32 geoalgorithms]
>> => [OGR] Conversion => Convert format in the Processing Toolbox. Still I
>> do not know how to get the code right in 'Creation Options'. It should be
>> something like
>> [-clipsrc ClippingPolygon.shp]. Anyone who has an idea?
>>
>> Best regards,
>> Jonas
>>
>>
>> 2014-10-14 20:36 GMT+02:00 Jonas Sjögren <jonas.sjo at gmail.com>:
>>
>>> Hi,
>>> to check that my data was ok I tried a clip tool in ArcMap where the
>>> same calcuation took exactly 10 seconds. After some modifications in my
>>> script and using the 'qgis:difference' algorithm, processing time was
>>> reduced to about 5 minutes, quite acceptable. Thank you for helping me sort
>>> this out.
>>> /Jonas
>>>
>>> 2014-10-14 7:47 GMT+02:00 Bernhard Ströbl <bernhard.stroebl at jena.de>:
>>>
>>>> Hm,
>>>>
>>>> goes pretty fast here, both with PostGIS and shp layers (some 5 lines,
>>>> 1 polygon, both layers in the same CRS as the project, shp on local drive)
>>>> QGIS 2.4 64 bit on Win7
>>>>
>>>> Bernhard
>>>>
>>>> Am 14.10.2014 02:49, schrieb Mike Flannigan:
>>>>
>>>>
>>>>> I am also using QGIS 2.4 64b Chugiak on Windows 7.
>>>>> The same thing happens to me.  Even when I create
>>>>> a line layer with only 11 lines and try to clip 3
>>>>> of them with a polygon layer, the progress bar just
>>>>> goes back and forth for ever.
>>>>>
>>>>> I didn't run it for hours to see what would eventually
>>>>> happen.
>>>>>
>>>>> Mike
>>>>>
>>>>>
>>>>> I might be doing something wrong.
>>>>>
>>>>> On 10/13/2014 8:02 AM, qgis-user-request at lists.osgeo.org wrote:
>>>>>
>>>>>> Hi,
>>>>>> I am trying to clip a road network by a polygon in a script using the
>>>>>> algorithm 'qgis:clip'. The result seems to be quite ok but it takes an
>>>>>> incredible long time to produce, about 14 hours (!). The road network
>>>>>> shapefile consists of about 5000 features (not very many, I believe)
>>>>>> and
>>>>>> the clipping shapefile consists of one single polygon. When using
>>>>>> Vector =>
>>>>>> Geoprocessing Tools => Clip from the QGIS menu, the time required is
>>>>>> about
>>>>>> the same. Does anyone have a clue why it takes so long time? Are there
>>>>>> other clip tools that I may try? I?ve been looking at the
>>>>>> 'gdalogr:ogr2ogr'
>>>>>> algorithm and its clipsrc function but not got it to work properly
>>>>>> yet. I?m
>>>>>> using QGIS 2.4 Chugiak on Windows 7 with 2.5 GHz processor. Thankful
>>>>>> for
>>>>>> all hints that may help,
>>>>>> /Jonas
>>>>>>
>>>>>
>>>>>
>>>>
>>>> __________ Information from ESET Mail Security, version of virus
>>>> signature database 10558 (20141014) __________
>>>>
>>>> The message was checked by ESET Mail Security.
>>>> http://www.eset.com
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Qgis-user mailing list
>>>> Qgis-user at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>
>>>
>>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20141019/3407f839/attachment.html>


More information about the Qgis-user mailing list