0

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?

Chris W
  • 15,720
  • 2
  • 29
  • 47
  • You are after an overlay operator (enforce polygon attributes on the points they contain) have a read of https://infogeoblog.wordpress.com/2013/01/08/geo-processing-in-qgis/ to get some of the basics or more specifically http://gis.stackexchange.com/questions/18453/how-to-create-a-new-layer-from-overlap-between-two-layers – Michael Stimson May 05 '15 at 23:49
  • 1
    Intersect the two layers, spatial join/query them, point sampling tool/plugin... there are lots of options/info out there for this analysis, including tutorials and even the QGIS documentation. There's even a tag here for it called [tag:point-in-polygon]. – Chris W May 06 '15 at 01:38

1 Answers1

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
Rick Monteiro
  • 133
  • 1
  • 1
  • 10