Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two layer, one (A) has point features and the other (B) has polygons. I need to produce a new table with some (the ID) or all the fields from the A table and some (the area code) or all from the B table where the B polygon contains the A point.

share|improve this question

2 Answers 2

It's possible to do a join on location ("where the B polygon contains the A point") using "Join attributes by location" from "Vector" menu. The resulting layer will contain all attributes from both layers.

A faster alternative is SAGA Add polygon attributes to points which is available through the Processing toolbox in QGIS.

share|improve this answer

Through SQL

You will need access to the data and access to a SQL db, you can derive the information via a simple SQL query. This example was written for SQL Server in TSQL.

The query will list the Hydrant (Layer A) and Fire District (Layer B) IDs along with common identifiers and the geometry definition of each. Because it has the geometry defined, if you were to insert these results into a table you can then review them in your map.

SELECT WHYDRANT.OBJECTID AS HYDID,
    WFIREDISTRICT.OBJECTID AS FDID, WHYDRANT.UNID AS UNID,
    WFIREDISTRICT.UNID AS FDUNID, WHYDRANT.SHAPE
FROM WFIREDISTRICT 
    INNER JOIN WHYDRANT ON 
        WFIREDISTRICT.SHAPE.STContains(WHYDRANT.SHAPE()) = 1
share|improve this answer

Your Answer

 
discard

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.