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?

1 Answer 1


It is possible using the QGIS "QSpatiaLite" plugin:

  1. Install QSpatiaLite plugin
  2. create SpatiaLite database connection
  3. Open QSpatialite plugin
  4. 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)
  5. 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

  6. check results in results tab

  7. from the SQL tab choose "Load in QGis as spatial layer" and click "run sql" again to load. See screenshot QSpatialite Options dialog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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