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

Swapping "Good" and "Bad"

Why different specifications for telescopes and binoculars?

An integral that needs subtitution to be solved.

Is it stylistically sound to use onomatopoeic words?

What happens to unproductive professors?

Did the Ottoman empire suppress the printing press?

How insert vertex in face?

IX-NAY on the IX-SAY

Hail hit my roof. Do I need to replace it?

How does the Melf's Minute Meteors spell interact with the Evocation wizard's Sculpt Spells feature?

What does the multimeter dial do internally?

A sequence that changes sign finally at infinity?

Conditions for Roots of a quadratic equation at infinity

Compressed gas thruster for an orbital launch vehicle?

Do we know SL(2,C) subgroups (not only finite ones)?

Are all diatonic chords in the diminished scale diminished?

When did "&" stop being taught alongside the alphabet?

Why does Trump want a citizenship question on the census?

Users forgetting to regenerate PDF before sending it

Generalized Behrend version for Grothendieck-Lefschetz trace formula

Why is the ladder of the LM always in the dark side of the LM?

When I press the space bar it deletes the letters in front of it

No Torah = Revert to Nothingness?

This LM317 diagram doesn't make any sense to me



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;








1















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?










share|improve this question









New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • 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
    10 hours ago

















1















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?










share|improve this question









New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • 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
    10 hours ago













1












1








1








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?










share|improve this question









New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 7 hours ago









PolyGeo

54.5k17 gold badges84 silver badges255 bronze badges




54.5k17 gold badges84 silver badges255 bronze badges






New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 11 hours ago









Julie W.Julie W.

91 bronze badge




91 bronze badge




New contributor



Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Julie W. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 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
    10 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
    10 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
10 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
10 hours ago










1 Answer
1






active

oldest

votes


















4














Given two sets of features A and B coloured red and blue:



overlaps



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:



nonoverlaps






share|improve this answer

























    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.









    draft saved

    draft discarded


















    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









    4














    Given two sets of features A and B coloured red and blue:



    overlaps



    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:



    nonoverlaps






    share|improve this answer



























      4














      Given two sets of features A and B coloured red and blue:



      overlaps



      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:



      nonoverlaps






      share|improve this answer

























        4












        4








        4







        Given two sets of features A and B coloured red and blue:



        overlaps



        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:



        nonoverlaps






        share|improve this answer













        Given two sets of features A and B coloured red and blue:



        overlaps



        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:



        nonoverlaps







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 10 hours ago









        SpacedmanSpacedman

        27.2k2 gold badges35 silver badges53 bronze badges




        27.2k2 gold badges35 silver badges53 bronze badges




















            Julie W. is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            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.




            draft saved


            draft discarded














            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





















































            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