0

I am working with a dataset that records violence cases (CSV file). All violence cases are geocoded to a latitude/longitude address so that they can be coordinated to any given shapes/polygons.

What would be the best method to determine whether a point (violence cases) lies within a polygon? I have a raster layer that may contains hundreds of polygons, and would like to generate boolean result (0/1) or dummy variables for each polygon.

3
  • Did I correctly understand your question: You want to determine whether a point (a vector) is within a polygon (a rater), is not it? Can you please clarify this info for us.
    – Taras
    Nov 24 at 5:54
  • Hi Taras. Yes. I am trying to determine whether a point is in a polygon. The points come from a csv data set and polygons come from a multipolygon layer. I believe both two layers are vector though.
    – Zhiwei Jin
    Nov 24 at 6:01
  • You can start with basics [1]"Join attributes by location" [2]Field Calculator with the overlay_within() function, [3]SAGA's "Add polygon attributes to points" module in the Processing Toolbox, or [4]gis.stackexchange.com/questions/86444/…, or
    – Taras
    Nov 24 at 6:13
1

Yes, it is totally possible by using the Vector menu, then navigating to the Spatial Query tool. Select within from the dropbox menu that appears on the tool and you're ready to go. This topic might also help.

But!

You said that you have a raster of many polygons. You must polygonize them using the polygonize tool first.

2
  • Hi Ash. I am sorry - I am working with vectors of many polygons. Does that mean I don't have to polygonize them first?
    – Zhiwei Jin
    Nov 23 at 21:31
  • 1
    If your two inputs are both vectors, you don't need to polygonize anything. Good luck.
    – Ash
    Nov 24 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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