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;








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
    8 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
    8 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 5 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 9 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
    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





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










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 8 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







            Popular posts from this blog

            ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

            Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

            Кастелфранко ди Сопра Становништво Референце Спољашње везе Мени за навигацију43°37′18″ СГШ; 11°33′32″ ИГД / 43.62156° СГШ; 11.55885° ИГД / 43.62156; 11.5588543°37′18″ СГШ; 11°33′32″ ИГД / 43.62156° СГШ; 11.55885° ИГД / 43.62156; 11.558853179688„The GeoNames geographical database”„Istituto Nazionale di Statistica”проширитиууWorldCat156923403n850174324558639-1cb14643287r(подаци)