[Qgis-user] Snapping tools really slow

Julien Cabieces julien.cabieces at oslandia.com
Fri Jan 22 00:57:12 PST 2021



Hi

> Hi,
>
> It might be best if I screen record you a video of it loading so you can see the performance issue as it is always difficult to discuss in text. I'll have to send that to you offline from this thread as I believe videos aren't supported by this group.
>

I agree, I'll wait for a video.

> We are snapping to Ordnance Survey MasterMap because we work in the
> public sector and are permitted to do so for council
> business. Depending on licencing you may not be able to access the
> same level of OS data as you would probably have to pay for it
> (assuming your company is private) so I guess that would not be
> helpful in terms of replicating the issue. That said; I also tried it
> using the OS Maps API (WFS) and it was also slow so OS may be able to
> share that with you for test purposes.

I try with some WFS, and indexing is as slow as rendering, meaning that
this probably data retrieval which slow down things under the hood.

>
> In the older version 3.10 the progress bar always disappeared for some
> reason so it appeared to just hand whilst the index builds. In the new
> version a blue bar appears at the bottom but it is not a loading bar
> it is the one you get when the application doesn't know how long is
> left. I tried to stop the process because it was long running and it
> said 'Indexing' was running did I want to try and stop the process so
> I'm pretty sure it is the indexing that is not working for some
> reason.

The progress bar disappears so the indexing is made in parallel for all
your layers and you can edit even if the index is not ready yet (snapping
would be not available until the index is ready though).

>
> Is there a way to pre-build the snapping index?
>

No. For some huge layers (millions of vertex), it's not possible to
index everything. QGIS try to guess the best reasonnable area to index
and rebuild it everytime you move outside this area.

That's why I told you about snapping range scale. QGIS would trigger
index building only in certain range scale (the relevant one for
edition), which decrease the size of index to build.

For some users who have huge amount of data, I also advice them to
change the indexing strategy using Python macros (Project > Properties >
Macro) with this code.


from qgis.utils import iface
from qgis.core import QgsSnappingUtils

def openProject():
    iface.mapCanvas().snappingUtils().setIndexingStrategy(QgsSnappingUtils.IndexExtent)

def saveProject():
    pass

def closeProject():
    iface.mapCanvas().snappingUtils().setIndexingStrategy(QgsSnappingUtils.IndexHybrid)
    

It would build index only for the canvas extent. With the appropriate
snapping range scale, you manage to avoid this long time waiting for
indexing (but it built index everytime you move...).

I'm ok it's not ideal, but so far this is the only way I know to manage
spapping on huge amount of data.


> It works fine for smaller layers, things we create etc. If I can resolve this one layer then all my problems go away so we would be really happy to pre-cache the snapping index if that is possible.
>
> Thanks,
> Paul
>
> -----Original Message-----
> From: Julien Cabieces <julien.cabieces at oslandia.com>
> Sent: 22 January 2021 05:32
> To: Paul Wittle <P.Wittle at dorsetcc.gov.uk>
> Cc: qgis-user at lists.osgeo.org
> Subject: Re: [Qgis-user] Snapping tools really slow
>
>
> Hi,
>
> I made quick tests with some dataset and I failed to see any performance issues.
>
> Could you create an issue with some data sample and project?
>
> Is it the index building that take a long time (there is a progress bar displayed at the bottom of the map close to the mouse coordinate information while index is currently building) or is it when you move your cursor on the map that the snaping information takes time to appear. Or is it when you pan the map?
>
> You can enable snapping for specific range of scale, avoiding building index at very large scale where snapping is useless.
>
> Regards,
> Julien
>
>
>
>> Hi,
>>
>> I've been using version 3.10 and 3.16 and I notice that enabling snapping is extremely slow and oddly significantly slower on 3.16 than 3.10. We thought it might be downloading the dataset on screen but discovered the data is back from the database within seconds and the delay is because QGIS is building an index.
>>
>> Why is it so inefficient and is there anything that can be done to get better performance?
>>
>> It is really slow and we are trying to transfer users from MapInfo / ESRI so they will not like the performance at the moment.
>>
>> To be clear the data has a primary key, spatial indices and all is of good quality. As I say the data downloads and displays within seconds on the map; is it because I've selected snapping to segment as well as vertex?
>>
>> Thanks,
>>
>> Paul Wittle
>> [cid:image001.jpg at 01D6F016.C23D1CA0]<https://www.dorsetcouncil.gov.uk/
>> >
>> Business Solutions Analyst (GIS)
>> ICT Operations
>> Dorset Council
>> 01305 228473
>> <tel:01305%20228473%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
>> %20%20%20> dorsetcouncil.gov.uk<https://www.dorsetcouncil.gov.uk>
>>
>> [cid:image002.png at 01D6F016.C23D1CA0]<https://www.facebook.com/DorsetCo
>> uncilUK>
>> [cid:image003.png at 01D6F016.C23D1CA0]<https://instagram.com/DorsetCounc
>> ilUK>
>> [cid:image004.png at 01D6F016.C23D1CA0]<https://twitter.com/DorsetCouncil
>> UK>
>>
>> This e-mail and any files transmitted with it are intended solely for
>> the use of the individual or entity to whom they are addressed. It may
>> contain unclassified but sensitive or protectively marked material and
>> should be handled accordingly. Unless you are the named addressee (or
>> authorised to receive it for the addressee) you may not copy or use
>> it, or disclose it to anyone else. If you have received this
>> transmission in error please notify the sender immediately. All
>> traffic may be subject to recording and/or monitoring in accordance
>> with relevant legislation. Any views expressed in this message are
>> those of the individual sender, except where the sender specifies and
>> with authority, states them to be the views of Dorset Council. Dorset
>> Council does not accept service of documents by fax or other
>> electronic means. Virus checking: Whilst all reasonable steps have
>> been taken to ensure that this electronic communication and its
>> attachments whether encoded, encrypted or otherwise supplied are free
>> from computer viruses, Dorset Council accepts no liability in respect
>> of any loss, cost, damage or expense suffered as a result of accessing
>> this message or any of its attachments. For information on how Dorset
>> Council processes your information, please see
>> www.dorsetcouncil.gov.uk/416433
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
> This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/416433



More information about the Qgis-user mailing list