[Python] Geopandas polygon within OR matches identically?

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I sub-polygons (1,2,3,4,5 in image below) for which I need to flag true or false if they are either within or identical to a boundary polygon (GROUP A in image below)

    [​IMG]

    [​IMG]

    For examples sake - the output should return as polygons 1-4 being within or identical to group A, and polygon 5 as not meeting that criteria.

    So far I have used the geopandas.within() function which picks up polygons 2-4, but not polygon 1 because there are no vertices within the group A polygon, only along the border.

    sub_polygons['within_group_flag'] = sub_polygons.within(groupA)


    Does anyone have a solution that would identify both situations and populate a column in sub-polygons with true/false? [​IMG]

    Continue reading...

Compartilhe esta Página