Issue with geopandas method 'contains' for two GeoDataFramesIntersecting two shape problem using...

Can an earth elemental drown/bury its opponent underground using earth glide?

Is there a math equivalent to the conditional ternary operator?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

How does signal strength relate to bandwidth?

Misplaced tyre lever - alternatives?

Is there a way to find out the age of climbing ropes?

Why are special aircraft used for the carriers in the United States Navy?

Sometimes a banana is just a banana

PTIJ: Aharon, King of Egypt

It doesn't matter the side you see it

A peculiar integral identity

Ahoy, Ye Traveler!

How can I highlight parts in a screenshot

How does insurance birth control work?

Lock enemy's y-axis when using Vector3.MoveTowards to follow the player

3.5% Interest Student Loan or use all of my savings on Tuition?

Can we carry rice to Japan?

Specific Chinese carabiner QA?

What could be a means to defeat a child’s nightmare?

Is every open circuit a capacitor?

Make me a metasequence

Practical reasons to have both a large police force and bounty hunting network?

Correct physics behind the colors on CD (compact disc)?

How do I deal with being envious of my own players?



Issue with geopandas method 'contains' for two GeoDataFrames


Intersecting two shape problem using geopandasPloting Multipoint with GeopandasProblems when use GeoPandas for Itersection between two Lines?How to import a background image for overlay with GeoPandasCreate a polygon grid using with GeopandasGeopandas overlay issueMerging two datasets where polygons are nearly identical using geopandas?TopologyException issue when doing intersection in Geopandas?Interchange y, x to x, y with geopandas (python) or QGISOverlay two linestring objects in geopandas, accounting for the attributes













0















I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2.



In the image is clearly visible that transect number 16 (TR_ID=16) is partially outside the mask2 polygon, while transect number 2 is within.



Mask2 polygon and transect_file2 transects file



Here is my code for reading the geopackages and changing the geometry name:



mask = gpd.read_file(r"C:jupytermasksmask_apollo20180601.gpkg")
transect_file = gpd.read_file(r"C:jupytertransects_gpkgapollo_transects_errortest.gpkg")

mask2 = mask.rename(columns={'geometry': 'geom'}).set_geometry('geom')
transect_file2 = transect_file.rename(columns={'geometry': 'geom'}).set_geometry('geom')


Then, I slice the transect GeoDataFrame into one line where tr_id = 16 and run the within method on the mask polygon to evaluate if the transect geometry is completly within the mask geometry, and it returns False, as expected.



a=transect_file2[transect_file2['TR_ID'] == 16]
mask2.within(a)


output of tr_id 16 within mask



If I change the transect ID with 2, which I know is completely within the mask, I expect the method .within to return True instead of False. But this does not happen.



Any clue on what I am missing?









share



























    0















    I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2.



    In the image is clearly visible that transect number 16 (TR_ID=16) is partially outside the mask2 polygon, while transect number 2 is within.



    Mask2 polygon and transect_file2 transects file



    Here is my code for reading the geopackages and changing the geometry name:



    mask = gpd.read_file(r"C:jupytermasksmask_apollo20180601.gpkg")
    transect_file = gpd.read_file(r"C:jupytertransects_gpkgapollo_transects_errortest.gpkg")

    mask2 = mask.rename(columns={'geometry': 'geom'}).set_geometry('geom')
    transect_file2 = transect_file.rename(columns={'geometry': 'geom'}).set_geometry('geom')


    Then, I slice the transect GeoDataFrame into one line where tr_id = 16 and run the within method on the mask polygon to evaluate if the transect geometry is completly within the mask geometry, and it returns False, as expected.



    a=transect_file2[transect_file2['TR_ID'] == 16]
    mask2.within(a)


    output of tr_id 16 within mask



    If I change the transect ID with 2, which I know is completely within the mask, I expect the method .within to return True instead of False. But this does not happen.



    Any clue on what I am missing?









    share

























      0












      0








      0








      I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2.



      In the image is clearly visible that transect number 16 (TR_ID=16) is partially outside the mask2 polygon, while transect number 2 is within.



      Mask2 polygon and transect_file2 transects file



      Here is my code for reading the geopackages and changing the geometry name:



      mask = gpd.read_file(r"C:jupytermasksmask_apollo20180601.gpkg")
      transect_file = gpd.read_file(r"C:jupytertransects_gpkgapollo_transects_errortest.gpkg")

      mask2 = mask.rename(columns={'geometry': 'geom'}).set_geometry('geom')
      transect_file2 = transect_file.rename(columns={'geometry': 'geom'}).set_geometry('geom')


      Then, I slice the transect GeoDataFrame into one line where tr_id = 16 and run the within method on the mask polygon to evaluate if the transect geometry is completly within the mask geometry, and it returns False, as expected.



      a=transect_file2[transect_file2['TR_ID'] == 16]
      mask2.within(a)


      output of tr_id 16 within mask



      If I change the transect ID with 2, which I know is completely within the mask, I expect the method .within to return True instead of False. But this does not happen.



      Any clue on what I am missing?









      share














      I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2.



      In the image is clearly visible that transect number 16 (TR_ID=16) is partially outside the mask2 polygon, while transect number 2 is within.



      Mask2 polygon and transect_file2 transects file



      Here is my code for reading the geopackages and changing the geometry name:



      mask = gpd.read_file(r"C:jupytermasksmask_apollo20180601.gpkg")
      transect_file = gpd.read_file(r"C:jupytertransects_gpkgapollo_transects_errortest.gpkg")

      mask2 = mask.rename(columns={'geometry': 'geom'}).set_geometry('geom')
      transect_file2 = transect_file.rename(columns={'geometry': 'geom'}).set_geometry('geom')


      Then, I slice the transect GeoDataFrame into one line where tr_id = 16 and run the within method on the mask polygon to evaluate if the transect geometry is completly within the mask geometry, and it returns False, as expected.



      a=transect_file2[transect_file2['TR_ID'] == 16]
      mask2.within(a)


      output of tr_id 16 within mask



      If I change the transect ID with 2, which I know is completely within the mask, I expect the method .within to return True instead of False. But this does not happen.



      Any clue on what I am missing?







      python shapely geopandas jupyter-notebook geodataframe





      share












      share










      share



      share










      asked 9 mins ago









      Nick PucinoNick Pucino

      209




      209






















          0






          active

          oldest

          votes











          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f314665%2fissue-with-geopandas-method-contains-for-two-geodataframes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          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%2f314665%2fissue-with-geopandas-method-contains-for-two-geodataframes%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

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...