You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today happened something weird, I was trying to use st_intersection from one geometry to a sf object, but it start returning nothing, but if only one feature intersects, all the results becomes only one value! From what I understand and I checked the docs, it should be a pairwise operation.
# All repeated just to do a pairwise intersectiona<-sf::st_read(a, quiet=TRUE)
b<-sf::st_read(b, quiet=TRUE)
# All of them has the same polygon, while is only one in b who intersectssf::st_intersection(b, a)
Simplefeaturecollectionwith6featuresand2fieldsGeometrytype:POLYGONDimension:XYBoundingbox:xmin:670008.4ymin:5930778xmax:670050.8ymax:5930827ProjectedCRS:WGS84/UTMzone18Sbageom52010 POLYGON ((670012.45930815,...5.12010 POLYGON ((670012.45930815,...5.22010 POLYGON ((670012.45930815,...5.32010 POLYGON ((670012.45930815,...5.42010 POLYGON ((670012.45930815,...5.52010 POLYGON ((670012.45930815,...#Empty...# Same result as sf::st_intersection(b[1:3,], a[1:3,])sf::st_intersection(b[1:3,], a)
Simplefeaturecollectionwith0featuresand2fieldsBoundingbox:xmin:NAymin:NAxmax:NAymax:NAProjectedCRS:WGS84/UTMzone18S
[1] bageom<0rows> (o0-extensiónrow.names)
# The element 5 in b now intersects, and fill all with "a" instead intersect it# Similar result as sf::st_intersection(b[1:5,], a[1:5,]) (changes the number of rows that shows)sf::st_intersection(b[1:5,], a)
Simplefeaturecollectionwith6featuresand2fieldsGeometrytype:POLYGONDimension:XYBoundingbox:xmin:670008.4ymin:5930778xmax:670050.8ymax:5930827ProjectedCRS:WGS84/UTMzone18Sbageom52010 POLYGON ((670012.45930815,...5.12010 POLYGON ((670012.45930815,...5.22010 POLYGON ((670012.45930815,...5.32010 POLYGON ((670012.45930815,...5.42010 POLYGON ((670012.45930815,...5.52010 POLYGON ((670012.45930815,...
Here is two issues:
Is not retuning the intersection, just one particular geometry all the time
With some... sets of data, it returns all empty, and if intersects return all with one geometry
I'm very confused, no idea why this happens, I tested it on CRAN and Git versions.
I'm not the user you tagged, but I came across this post when I was dealing with the same issue. For me it was that my geometry set was a series of linestrings that i cast to polygons. This created overlapping points that st_intersection did not like, but also didn't throw an error for instead returning empty geometries. I fixed this by throwing st_make_valid() around my geometry. Maybe this will work for you as well.
If you found another solution I'd be interested in hearing it as well.
Hi! thx for the suggestion, I was using a lot of data, so I moved from R to Postgis and simplify all the workflow..... I did not found any other solution for this......
Hi again @edzer has been a while :)
Today happened something weird, I was trying to use st_intersection from one geometry to a sf object, but it start returning nothing, but if only one feature intersects, all the results becomes only one value! From what I understand and I checked the docs, it should be a pairwise operation.
sample.zip
Here is two issues:
I'm very confused, no idea why this happens, I tested it on CRAN and Git versions.
Thx!
The text was updated successfully, but these errors were encountered: