# How to iterate through geometry polygons with Python API

**URL:** <https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785>\
**Category:** Uncategorized\
**Tags:** python\
**Created:** [November 4, 2024, 7:44pm UTC](https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785 "2024-11-04T19:44:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeoBBL](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@LeoBBL](https://forum.itascainternational.com/u/LeoBBL)\
**Post date:** [November 4, 2024, 7:44pm UTC](https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785/1 "2024-11-04T19:44:08Z")

</div>

Hello everyone

I need to iterate through the list of polygons of a geometry set, for then assign some values to extras.

I know that it can be done with geom.poly.list() FISH function via loop foreach, but I’m looking to do it in Python. The 9.2 software version includes Python API for geometry with new functions and classes, but there is no direct equivalent.

I asked this the new AI assistant, and it answered that I should use “itasca.geometry.poly.list()” function, which Itasca softwares do not recognize, and also it is not in the 9.2 version software documentation, therefore I assume it does not exist actually.

Thanks in advance for any input.  
Regards,

-Leo

---

<div class="post-metadata">

**Author:** ![msepu](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@msepu](https://forum.itascainternational.com/u/msepu)\
**Post date:** [November 4, 2024, 8:39pm UTC](https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785/2 "2024-11-04T20:39:36Z")

</div>

[https://docs.itascacg.com/itasca920/common/docproject/source/manual/scripting/python/doc/itasca.geometry.html?node8610](https://docs.itascacg.com/itasca920/common/docproject/source/manual/scripting/python/doc/itasca.geometry.html?node8610)

take a look at this part of the documentation. It should be usefull

---

<div class="post-metadata">

**Author:** ![Huy](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Huy](https://forum.itascainternational.com/u/Huy)\
**Post date:** [November 7, 2024, 8:45am UTC](https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785/3 "2024-11-07T08:45:04Z")

</div>

Hi Leo,  
The list of polygons belongs to a geometry set object, so the syntax should be

```auto
for gset in it.geometry.list():
     for poly in gset.polys(): 
         ...
```

---

<div class="post-metadata">

**Author:** ![LeoBBL](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@LeoBBL](https://forum.itascainternational.com/u/LeoBBL)\
**Post date:** [March 4, 2025, 2:42pm UTC](https://forum.itascainternational.com/t/how-to-iterate-through-geometry-polygons-with-python-api/1785/4 "2025-03-04T14:42:11Z")

</div>

Thanks @Huy but will this iterate all geometry sets? I need to iterate through a specific geometry set.
