I have a shapefile that is covering a huge area, with lots of polygons. The area I'm insteresting in is small and limited. Is there any way to only import (using "add vector layer") the polygons from the shapefile that covers my smaller area?

How can I do this in QGIS? How do I specify the smaller area for my import?


As far as I know, this is not possible using the GUI since the underlying OGR library doesn't support spatial queries (Source: Spatial joins in OGR SQL).

You could write a Python solution for this problem. It could check the feature bounding box against your area of interest and only add the feature to the QGIS layers if the areas overlap.

  • Supposing you intend to have a subset of your data. vs loading a 'select by location'.

Using QGIS 1.7.0 and with the ftools plugin installed [Carson Farmers Repository - under the plugin Installer]

  1. Load your main file (with the many polygons - from which you intend to select a few)
  2. Load clipper polygon shapefile (or create one i.e. covering your target small area)
  3. Intersect 1 and 2. Tool accessible from the Vector menu in QGIS.
  4. Voila! Your few polygons.
  1. Import the larger shapefile.
  2. Either you have your area of interest in a shapefile, or you can easily make a new layer (shapefile) in QGIS.
  3. Intersect and you are done.

I hope this helped.

Cheers N

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.