I have a bunch of 'points' in a csv that contain a zip code and lat/long coordinates. I also downloaded the ZCTA boundary data from the census website. I successfully imported the point layer on top of the zip boundary layer, however, I'd like to determine if there are any 'points' that lie outside of it's associated zip boundary layer.
1) Points = Zip Code, Latitude, Longitude 2) Zip Boundary Shapefiles
Basically I want to determine which points' latitude/longitude (and zip code) does not line up with its corresponding zip boundary layer. I definitely know this is possible, and I can also do it manually by hand, but
How do I do this for a set of points using QGIS?
It is possible using the QGIS "QSpatiaLite" plugin:
- Install QSpatiaLite plugin
- create SpatiaLite database connection
- Open QSpatialite plugin
- import both polygon and point shapefile to spatialite database (i used the layers "gis_se" as my point layer and "zippoly_gisse" as polygon layer)
run a sql statement like
select point.id, point.zipcode, poly.id, poly.zipcode, point.Geometry as PGeometry from gis_se as point, zippoly_gisse as poly where ST_Within(point.GEOMETRY, poly.Geometry) and point.ZIPCODE <> poly.ZIPCODE
check results in results tab
- from the SQL tab choose "Load in QGis as spatial layer" and click "run sql" again to load. See screenshot