# Get x/y-coordinates from selection

**URL:** <https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729>\
**Category:** UXP Plugin API\
**Tags:** ui\
**Created:** [April 21, 2020, 1:38pm UTC](https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729 "2020-04-21T13:38:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jojo](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Jojo](https://forums.creativeclouddeveloper.com/u/Jojo)\
**Post date:** [April 21, 2020, 1:38pm UTC](https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729/1 "2020-04-21T13:38:47Z")

</div>

Hey,  
thats probably a very easy question, but anyway - I would like to get the x- and y-coordinates out of my selected object.  
When I say selection.items[0] than I get this - for example:

[ Rectangle (‘Rechteck 1’) {  
width: 633, height: 248  
global X,Y: 251, 243  
parent: Artboard (‘Web 1920 – 1’)  
stroke: ff707070  
fill: ffe44444  
} ]

now I get everything out of this object execpt the “gobal X,Y”…

Thanks for any ideas! 🙏

---

<div class="post-metadata">

**Author:** ![pklaschka](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/pklaschka/32/3162_2.png) [@pklaschka](https://forums.creativeclouddeveloper.com/u/pklaschka)\
**Post date:** [April 21, 2020, 4:17pm UTC](https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729/2 "2020-04-21T16:17:03Z")

</div>

Hi @Jojo,

please have a look at the [scenegraph documentation](https://adobexdplatform.com/plugin-docs/reference/scenegraph.html). Each `SceneNode`, among other properties, has `localBounds`, `boundsInParent` and `globalBounds`, which are objects with `x`, `y`, `width` and `height`.

Take a look at [https://adobexdplatform.com/plugin-docs/reference/core/coordinate-spaces-and-units.html](https://adobexdplatform.com/plugin-docs/reference/core/coordinate-spaces-and-units.html). Adobe XD uses (and, through the APIs, exposes) multiple coordinate systems. Depending on which you want, you then can access it using `node.xyBounds.x` and `node.xyBounds.y` (here, replace `xy` with `local`, `global` or whatever else you need.

```auto
// a "full" example
const selection = require('scenegraph').selection;

for (let node of selection.items) {
  console.log(node.localBounds.x, node.localBounds.y);
}

```

I hope this helps,  
Best,  
Pablo

---

<div class="post-metadata">

**Author:** ![Jojo](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Jojo](https://forums.creativeclouddeveloper.com/u/Jojo)\
**Post date:** [April 21, 2020, 7:35pm UTC](https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729/3 "2020-04-21T19:35:58Z")

</div>

Hey Pablo,  
thanks for helping me again! 🙏 🙃

The .globalDrawBounds.x gets me what I needed - so thanks for the hint!  
(I will try to read the docs more carefully! 😇 )

Best,  
Jojo

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [April 22, 2020, 11:50pm UTC](https://forums.creativeclouddeveloper.com/t/get-x-y-coordinates-from-selection/1729/4 "2020-04-22T23:50:12Z")

</div>

We have a free tool for accessing this kind of per-node API information in a panel you can download and install:

> **[Layers 4 Developers](https://emsoftware.com/products2/layers-4-developers/)**
>
> XD scenegraph exploration panel Layers 4 Developers is a plugin that shows the current Adobe XD scenegraph selection, the whole document, or the current edit context root, as a dynamically updated,…

which leads (on the right sidebar) to a direct install link

[https://xd.adobelanding.com/en/xd-plugin-download/?name=6440ed65](https://xd.adobelanding.com/en/xd-plugin-download/?name=6440ed65)

Hope this is helpful.
