I have a vector layer of land parcels and another layer of polygons separating them into territories. I am trying to identify which territory each parcel is in within a python plugin. My plan is to iterate over the parcels, and for each parcel iterate through the territories and test which it's inside. I'm not sure whether to use .contains(), .within(), or .intersects()
My concern is what happens if a parcel is half inside one territory, and half inside another. I'd like the plugin to figure out which has the biggest portion of it and return that one. How do I test for that? edit: I've thought about using a spatial join to accomplish this, but for some reason I get errors with my dataset. And I want more control in this exact situation than arbitrarily choosing the minimum or maximum value for object ID)
أكثر...
My concern is what happens if a parcel is half inside one territory, and half inside another. I'd like the plugin to figure out which has the biggest portion of it and return that one. How do I test for that? edit: I've thought about using a spatial join to accomplish this, but for some reason I get errors with my dataset. And I want more control in this exact situation than arbitrarily choosing the minimum or maximum value for object ID)
أكثر...