Finding overlapping polygons in two shapefiles and deleting them in R?Merging more than two shapefiles in QGISHow to merge overlapped shapefiles without one layer's overlapping area?Matching (joining) two slightly incompatible polygon shapefilesCounting polygons in one layer that are overlapping/touching/contained in each polygon in separate layer of contiguous polygons using QGIS?Overlapping polygons in the same table/ layerR- Polygons overlapping PolygonsDeleting overlapping lines using ArcGIS Desktop?ArcMap Way to merge two shapefiles and take the average of their polygons that overlap?Polygon Shapefile Overlap with a RasterCalculating area difference between two polygon shapefiles using QGIS
Is there a method for differentiating informative comments from commented out code?
I make billions (#6)
What does collachrimation mean?
Did depressed people far more accurately estimate how many monsters they killed in a video game?
Why AI became applicable only after Nvidia's chips were available?
Why does Trump want a citizenship question on the census?
No Torah = Revert to Nothingness?
What minifigure is this?
Are there red cards that offer protection against mass token destruction?
Appropriate conduit for several data cables underground over 300' run
When an electron changes its spin, or any other intrinsic property, is it still the same electron?
User Vs. Connected App
What are the consequences for a developed nation to not accept any refugees?
Why was such an unrevealing title originally chosen and then changed for some International markets?
Would a Nikon FG 20 film SLR camera take pictures without batteries?
VHF 50 Ω Antenna Over 75 Ω TV Coax
My previous employer committed a severe violation of the law and is also being sued by me. How do I explain the situation to future employers?
US citizen traveling with Peruvian passport
What was this character's plan?
Was it ever illegal to name a pig "Napoleon" in France?
How to find the positions of replaced elements in a list
Don't the events of "Forest of the Dead" contradict the fixed point in "The Wedding of River Song"?
IX-NAY on the IX-SAY
Can Jimmy hang on his rope?
Finding overlapping polygons in two shapefiles and deleting them in R?
Merging more than two shapefiles in QGISHow to merge overlapped shapefiles without one layer's overlapping area?Matching (joining) two slightly incompatible polygon shapefilesCounting polygons in one layer that are overlapping/touching/contained in each polygon in separate layer of contiguous polygons using QGIS?Overlapping polygons in the same table/ layerR- Polygons overlapping PolygonsDeleting overlapping lines using ArcGIS Desktop?ArcMap Way to merge two shapefiles and take the average of their polygons that overlap?Polygon Shapefile Overlap with a RasterCalculating area difference between two polygon shapefiles using QGIS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have two shapefiles with more than 1000 polygons each, and they represent two types of agricultural fields in the same area, which means they should be different types.
Some of the polygons are partly or completely overlapped - what I want to do is to delete those polygons - from both shapefiles - that are overlapped. Are there any methods for doing this in R using pachage sf or rgdal?
shapefile r polygon overlapping-features
New contributor
add a comment |
I have two shapefiles with more than 1000 polygons each, and they represent two types of agricultural fields in the same area, which means they should be different types.
Some of the polygons are partly or completely overlapped - what I want to do is to delete those polygons - from both shapefiles - that are overlapped. Are there any methods for doing this in R using pachage sf or rgdal?
shapefile r polygon overlapping-features
New contributor
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago
add a comment |
I have two shapefiles with more than 1000 polygons each, and they represent two types of agricultural fields in the same area, which means they should be different types.
Some of the polygons are partly or completely overlapped - what I want to do is to delete those polygons - from both shapefiles - that are overlapped. Are there any methods for doing this in R using pachage sf or rgdal?
shapefile r polygon overlapping-features
New contributor
I have two shapefiles with more than 1000 polygons each, and they represent two types of agricultural fields in the same area, which means they should be different types.
Some of the polygons are partly or completely overlapped - what I want to do is to delete those polygons - from both shapefiles - that are overlapped. Are there any methods for doing this in R using pachage sf or rgdal?
shapefile r polygon overlapping-features
shapefile r polygon overlapping-features
New contributor
New contributor
edited 5 hours ago
PolyGeo♦
54.5k17 gold badges84 silver badges255 bronze badges
54.5k17 gold badges84 silver badges255 bronze badges
New contributor
asked 9 hours ago
Julie W.Julie W.
91 bronze badge
91 bronze badge
New contributor
New contributor
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago
add a comment |
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Given two sets of features A and B coloured red and blue:
Then select only those from A that don't overlap any B and vice versa:
> Adash = A[lengths(st_intersects(A,B))==0,]
> Bdash = B[lengths(st_intersects(B,A))==0,]
this works by virtue of the element of the intersection list having zero-length when a feature has no intersections.
When plotted:
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Julie W. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f328061%2ffinding-overlapping-polygons-in-two-shapefiles-and-deleting-them-in-r%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Given two sets of features A and B coloured red and blue:
Then select only those from A that don't overlap any B and vice versa:
> Adash = A[lengths(st_intersects(A,B))==0,]
> Bdash = B[lengths(st_intersects(B,A))==0,]
this works by virtue of the element of the intersection list having zero-length when a feature has no intersections.
When plotted:
add a comment |
Given two sets of features A and B coloured red and blue:
Then select only those from A that don't overlap any B and vice versa:
> Adash = A[lengths(st_intersects(A,B))==0,]
> Bdash = B[lengths(st_intersects(B,A))==0,]
this works by virtue of the element of the intersection list having zero-length when a feature has no intersections.
When plotted:
add a comment |
Given two sets of features A and B coloured red and blue:
Then select only those from A that don't overlap any B and vice versa:
> Adash = A[lengths(st_intersects(A,B))==0,]
> Bdash = B[lengths(st_intersects(B,A))==0,]
this works by virtue of the element of the intersection list having zero-length when a feature has no intersections.
When plotted:
Given two sets of features A and B coloured red and blue:
Then select only those from A that don't overlap any B and vice versa:
> Adash = A[lengths(st_intersects(A,B))==0,]
> Bdash = B[lengths(st_intersects(B,A))==0,]
this works by virtue of the element of the intersection list having zero-length when a feature has no intersections.
When plotted:
answered 8 hours ago
SpacedmanSpacedman
27.2k2 gold badges35 silver badges53 bronze badges
27.2k2 gold badges35 silver badges53 bronze badges
add a comment |
add a comment |
Julie W. is a new contributor. Be nice, and check out our Code of Conduct.
Julie W. is a new contributor. Be nice, and check out our Code of Conduct.
Julie W. is a new contributor. Be nice, and check out our Code of Conduct.
Julie W. is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f328061%2ffinding-overlapping-polygons-in-two-shapefiles-and-deleting-them-in-r%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Clarification needed. You have two shapefiles, call them A and B. You want to create two new shapefiles, A' and B' where A' is the set of all features from A that do not touch or overlap or intersect any features in B, and where B' is similar for features in B not overlapping any features in A? Or is there a possibility of features in A overlapping with other features in A?
– Spacedman
8 hours ago