I have two different statewide layers of points. One set of points are locations of ballot dropboxes and the other points are residences. Both layers have a column for city. I'm trying to calculate the nearest dropbox to each residence and end up with a table of the closest dropbox to the residence that retains the residence unique id and all the attributes of the dropbox layer (geo, address string, note string). The catch is they must be in the same city. For example, in northern Boston, MA, the nearest dropbox point by distance is in southern Cambridge, MA but Boston voters cannot drop off their ballot in Cambridge; it must be a Boston dropbox if the residence is in Boston.
I'm trying to understand QGIS better and it seems like this is maybe something I could iterate over although I'm not sure how I'd go about something like residence.city == dropbox.city for each city. Or is it more of a batched process or something that would require a model?