Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two polygon layrers, each layer a table in PostgreSQL: One layer with polygons areas in a city. Another layer with buildings (polygons) that are within areas.

How can I to do to know what buildings are in each areas? Can I have a list or csv with that information?

Something like: layer1(area) -> layer1, 3, 4 (buildings)

Thank you

share|improve this question
You need to reword the question. Is it simple thing of selecting the polygons within an area and saving them out as a CSV file? – Ger May 3 '13 at 8:47
Thks Gerald. Yes the question is this.Select the polygons within an area (this area is also a polygon of a layer) and saving them out as a CSV file – user1573901 May 3 '13 at 8:59

Try Vector > Reserch Tools > Then Slect features from the buildings layer that intersect with the base layer.

Then close. Right click on the buildings layer. Save selection as Comma Seperated Value. And that is it I think..

Hopefully on the point here. if not I will remove this as could confuse things.

share|improve this answer
Thks Geral, This creayes a csv just with the ID of one of the layers, I want with two layers, like: layer1(area) -> layer1, 3, 4 (buildings) – user1573901 May 3 '13 at 10:32
I want to know what building ID's are in each areas – user1573901 May 3 '13 at 10:49
guessing at this but open to suggestions. Why not take the layers you want and combine them to one layer under the data management tool. I have not tried it but will now. I am guessing it should do it but dont know how the results will come out. – Ger May 3 '13 at 12:14

If your tables are spatial (you didn't mention if this is a PostGIS database?) then use ST_Contains:

FROM areas AS a, buildings AS b
WHERE ST_Contains(a.geom, b.geom)

More details here

share|improve this answer
hi Micha, yes is a PostGIS. – user1573901 May 3 '13 at 16:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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