3

Software: QGIS Desktop 3.0.3

Data Type: Vector Point and Polygon feature layers

Action: Select based on particular field matching and return/highlight based on geographic location according to a particular rule (point feature lies within polygon feature)

I have a large data-set (80,000+) of point features for homes in the state of Florida. The point feature layer has a field showing the parcel #.

I also have a polygon layer highlighting parcel boundaries for the parcels in the state of Florida with a field that also shows parcel #.

I am trying to create/discover a tool or script to run that will a take that a sample set (10,000) of points I've manually extracted from the point feature layer, and select/highlight/return all point features that fall within the boundary of the specific polygon parcel boundary layer feature that matches the same parcel # number as the point feature. So in a nutshell,

I want to:

  • Match up the point features and polygon features that have matching(identical) Parcel Numbers in their attributes
  • Select/return all points that do or do not lie entirely within their respective polygon feature with the same parcel number as the point feature
  • This will provide me with a quick way of QA/QC that most (95%) of the point features are in their correct geographic (lat/long) location.

closed as off-topic by Dan C, Vince, PolyGeo Jun 13 '18 at 20:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Dan C, Vince, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I do not at all see this question as off-topic. Your hardness will have newcomers end up having a difficult time asking a question. This problem could also be solved without code using existing dialogs of QGIS, leaving the specific reason for put on hold obsolete. Give the man a chance :) – Jakob Jun 14 '18 at 14:48
  • >>Dan C, Vince, PolyGeo: Here is another one you can but on hold; No code but a solution available using SQL: gis.stackexchange.com/questions/284670/… – Jakob Jun 15 '18 at 9:50
4

Use Virtual Layers - the hidden force of QGIS

I can not come up with an easier answer than using Virtual Layers. You can use two Virtual Layers in QGIS joining the tabels on your needs.

Having two test tables mypoint and mypolygon:

enter image description here

Find all points matching polygon layer parcelid and within polygon:

select poi.geometry, poi.parcelid, poly.parcelid 
from mypoint poi
inner join mypolygon poly using (parcelid)
where st_within(poi.geometry, poly.geometry)

Showing as the blue points:

enter image description here

Find all points matching a polygon layer parcelid but not within polygon with matching parcelid

select poi.geometry, poi.parcelid, poly.parcelid 
from mypoint poi
inner join mypolygon poly using (parcelid)
where not st_within(poi.geometry, poly.geometry)

Showing as the red points:

enter image description here

You can find the Virtual Layers editor within the Datasource Manager

enter image description here

Note Virtual Layers are dynamic. Changing the point and polygons will automatically update the Virtual Layers on a map refresh.

  • Jakob, This method definitely worked. Just cut my QA/QC time down to a matter of minutes. Appreciate it dude! – James Cooper Jun 13 '18 at 18:05

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