0

This question already has an answer here:

Complete newbie to QGIS and can't seem to find how to do this.

I have created a map with 84 different polygons. Then I've imported approx. 8000 points.

What I want to do is now query my map and get it to tell me the polygon each Point is in and then be able to extract this into a text or CSV file.

Can anyone help?

marked as duplicate by Chris W, PolyGeo May 6 '15 at 2:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I do not have access to QGIS on this CPU but, I would like to propose an alternate solution.

You can perform the analysis in QGIS but if you are only interested in the report, writing SQL is more efficient.

You will need access to the data and access to SQL Server, you can derive the information via a simple SQL query. Other SQL providers such as PostGRESQL and MYSQL will support similar functions.

This query will list the Hydrant and Fire District 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

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