Jump to content

Error when using the "Points in Polygon" function

Lindsey Walton

Recommended Posts

I am getting an error when I try to use this function that says:

Error in validObject(res) : invalid class "SpatialPolygons" object: non-unique Polygons ID slot values

eval(expr, envir, enclos)

eval(expr, envir, enclos)

readWKB(Geometry, Id, proj4string = CRS("+proj=longlat +datum=WGS84"))

SpatialPolygons(obj, proj4string = proj4string)


stop(paste("invalid class "", Class, "" object: ", msgs,


I am trying to find what section- township- range a set of wells are in based on bottom hole locations that are reported in Lat-Long coordinates.

Link to comment
Share on other sites

Sounds like the column you choose for the ID in your shapefile has duplicates. Like if you chose township name, probably somewhere in your data there are two townships with the same name. Often times there's a column in shapefiles called GEOID and that's usually unique, then you just have to match the GEOID to the names after you run the point in a polygon.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...