I have created a map using MapWindows like the following:


A little explanation here, the is a map of an elderly home. The yellow boxes are room and the white rectangles inside the yellow boxes are the beds.

I have a few things that need to be done using QGIS (preferably integrated with R so that I can automate the process):

  1. I need to check whether the beds are "appropriately" placed in the room. For example, in the "lower-left quadrant" room, the "upper-right quadrant" bed is place outside the boundary of the room, this is not appropriate and I need to fix it.

  2. I need to count how many beds are there in one room. Can I do it in GIS/R?

  3. I need to know if a particular bed is in the same room as another particular bed.

I have about 40 maps and a total of >2000 beds, I can't do the 3 things above manually. I wonder if some mechanical means can help.

I am using MapWindows for creating the maps, QGIS for visualization, and R for data processing (checking the dbf files for the naming of the beds, creation of csv files for giving "information" for each bed). I wonder if the 3 tools will be sufficient for the 3 tasks above.

Thanks in advance.

1 Answer 1


You can do all this with R, using the rgeos package to check for overlapping geometries for (1); to count geometries within geometries for (2); and to test which geometries are within other geometries for (3).

Obviously a simple R loop can do this for however many data sets you've got.

A trickier problem would be automatically fixing the problems spotted by (1), but maybe you won't have many of these and its enough for R to flag them up for you to manually edit them in Qgis.

Your Answer

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

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