# Combined arrays position text

**URL:** <https://discourse.processing.org/t/combined-arrays-position-text/37452>\
**Category:** Coding Questions\
**Created:** [June 10, 2022, 1:22pm UTC](https://discourse.processing.org/t/combined-arrays-position-text/37452 "2022-06-10T13:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvb](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mvb](https://discourse.processing.org/u/mvb)\
**Post date:** [June 10, 2022, 1:22pm UTC](https://discourse.processing.org/t/combined-arrays-position-text/37452/1 "2022-06-10T13:22:05Z")

</div>

I have a loaded image of a country and an int array with the coordinates and population of each city, and another string array with the names of the cities. I want to combine them and have the names of the cities appear in the picture in the position next to them. How could I do that? Should I select the X and Y positions?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [June 10, 2022, 2:29pm UTC](https://discourse.processing.org/t/combined-arrays-position-text/37452/2 "2022-06-10T14:29:36Z")

</div>

Yes

Use the same index `i` e.g. for both

`text(names[i], mainList[i][0], mainList [i][1]);`

---

<div class="post-metadata">

**Author:** ![Chigoz](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@Chigoz](https://discourse.processing.org/u/Chigoz)\
**Post date:** [June 10, 2022, 4:24pm UTC](https://discourse.processing.org/t/combined-arrays-position-text/37452/3 "2022-06-10T16:24:07Z")

</div>

So much effort has been put to solve a similar question. Check solution 11+ of this thread.

> [@I need help with arrays](https://discourse.processing.org/t/i-need-help-with-arrays/37381/14):
>
> Check out this correction; distancesSG = calc\_Distance(Pos\_XS,Pos\_YS ,Pos\_GX,Pos\_GY); distances = (cities[i][j],cities[i][j+1], distancesSG);
