We want to have a map of each individual district, with the shops on it, so that the person responsible for each district can have a map of their territory. The reason I want to merge them is so that I don't end up with a map of one district with lots of dots around it from other shops all over the state.

I'm using QGIS 1.7.0. I have a shapefile that splits my state into districts, and a geoJSON that has a list of shop locations. I want to make a file of each district, with a dot at each shop. Is it possible to have QGIS put both pieces of information into one file (I haven't had any luck with merge shapefiles). After that, it would be wonderful if I could get it to split each section into it's own file, with the dots that it contains. If there is not a way to get it to do that automatically, would the most efficient thing to do be putting a mask layer over the map and just cutting out a hole for each district, one at a time?

I'm mostly self-taught with QGIS, so I don't necessarily know some of the non-basic stuff. But I'd appreciate any help y'all could give me.

  • Thanks for the help and ideas everyone! I really appreciate it.
    – Nancy
    Jul 19 '12 at 3:45
  • 6
    Nancy, it is indeed kind of you to thank everyone. It would be even more useful for you to accept one of these answers if it in fact helped you out: that makes it easier for future readers to sort things out for themselves. Thanks!
    – whuber
    Jul 19 '12 at 14:33

It is not possible to put points and polygones into one shapefile, because of the different geometry. In addition, it is not wishfull to make a different shapefile for each district. That will give you to many shapefiles while you can do it with just one.

Now the way to do it:

You can enrich a shapefile with the attributes of another shapefile: Give each store a column with the name of the district where it belongs to.

First you have to save your geoJSON as a shapefile. Rightclick > Save as, choose esri-shapefile.

Select the new made shapefile with the stores.

  • Go to vector > geoprocessing tools > union.

enter image description here

  • Set as input vector the shape with your stores.
  • Set as union layer your shape with the districts.
  • Give it a name and confirm. Add the new shape to the TOC.
  • Look at the attibutetable and you will notice that the data of the district file is added to the shops.

For making a different map of each district with only the shops of that district. You have to tell your shapefiles to only show the district and the shops you want to see. That has to be done with a query.

  • Rightclick on your districtfile in TOC > query

enter image description here

You can now define wich features you want to show.

  • Doubleclick in 'Fields' on the field that contains the data where you want make a selection (name of the district).
  • Click '='
  • Click 'Sample' under 'Value'
  • Doubleclick the districtname which you want select.
  • Confirm

enter image description here

Do the same with the storefile. Make a query on one of the new added columns.

Now you can make a map in the mapcomposer for each district, doing the above steps for each individual district.


You could use the Atlas plugin in QGIS. Since you are trying to create maps that can be handed over to people, using Atlas would make it very easy for you to have the map created for all districts automatically and have a nicely formatted output. Use your district shapefile as the 'coverage' layer and in the output map only points within the district boundary will be shown.

One limitation of this approach is that some points outside the boundary will also be shown as the map view will be based on the bounding box of each of the districts. More on Atlas plugin here, http://www.oslandia.com/tech/?p=1079

  • That's the easy way, yes. But the aim was to hide the stores that fall outside the district. grtz
    – PieterB
    Jul 18 '12 at 9:12
  • thanks. that's true. modified my answer to reflect that. Jul 18 '12 at 15:17

A very easy technique that would not require you to edit your source "shops" layer would be to simply put your "districts" layer above the "shops" layer in the table of contents, and set a definition query (as shown by @PieterB) where the districts are NOT EQUAL to the district in question.

This method would effectively mask any layers that fall outside of the district you want to view. You could then use the Atlas plugin as mentioned by @spatialthoughts, or the EasyPrint plugin to generate the map sequence.

One benefit of creating a mask like this, is that you could put a transparency factor (of say 15%) which would allow you to see the shops in other districts (which I think makes it easier to understand the surrounding areas), but focus the viewers attention on the specific district.


Another idea, based on what you want the map to look like, is to overlay with a shapefile that has the municipality/district boundaries (if you have it). Select all shapes, fill them with a plain white. The municipality you want to let show through you set transparant.

Can work like a charm to limit maps to a certain area, however, doing so limits ALL visible data on the map to that municipality/district

Very similar to what is mentioned in one of the other replies here, but the dataset to create the mask is most likely available.

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.