3

I have to make several atlases of a large region in France. My study area is relatively small compared to the entire region. However, most of my layers are related to the entire region.

As I intend to use this study in new areas, I would like to know if it is possible in QGIS to limit the shapefile loading so that my project is not so slow to work.

For example, I want the hydrography layer that QGIS "shows" to be just the region I choose, without having to use the geoprocessing and clip the shapefile.

My idea is to prevent the program from loading data that I don't care about, without having to modify the all files.

I already limited the visibility scale of my shapefile, but that didn't help, as there are many layers, the program continues to suffer to run the atlas. The point is not just to create a "mask", but to prevent the program from loading what I don't care about.

2
  • Why isn't clipping an option? Because it is the easiest and most straightforward option.
    – Erik
    Commented Oct 13, 2022 at 12:59
  • 1
    Convert your shapefile into GeoPackage and QGIS should read just the features which intersect the view.
    – user30184
    Commented Oct 13, 2022 at 13:08

1 Answer 1

2

You can do what you want with virtual layers. See the documentation is at https://docs.qgis.org/3.22/en/docs/user_manual/managing_data_source/create_layers.html

Example about clipping a shapefile to contain only the features that intersects with a 2 by 2 degrees envelope.

Use the Create virtual layer tool

enter image description here

Define the BBOX

enter image description here

The virtual layer is using the original shapefile as source but reads only the features which intersect the BBOX. The original layer in only as a reference in the image, it can be removed from the QGIS project.

enter image description here

Create a virtual layer with a query like this

SELECT *
FROM states
WHERE _search_frame_=BuildMbr(-102,40,-98,44,4326)

If the virtual layer feels still slow, try to create a spatial index for your source data if it is missing. You can do that with a button in Layer properties - Source - Geometry. However, I believe that virtual layer is utilizing another type of spatial index and it is the original shapefile layer that gets more benefit from this operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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