# Read the Coordinates in perspective

**URL:** <https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 20, 2023, 12:06pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845 "2023-01-20T12:06:08Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 12:06pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/1 "2023-01-20T12:06:08Z")

</div>

i want to read the coordinates on clicking anywhere on the Screen. For that i have two labels one for X coordinate and other for Y coordinate.  
once got the coordinates value i want to move the circle for the particular location as per coordinates value we received.  
this requirement is in Perspective.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 12:15pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/2 "2023-01-20T12:15:01Z")

</div>

You should use the canvas component that covers the whole clickable screen.  
There you can put on onmouseclick event on which contains coordinates, and its also easy to put a component in it with specific coordinates

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 12:20pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/3 "2023-01-20T12:20:47Z")

</div>

Thanks for replying @victordcq, could you have some python code for that..

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 12:43pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/4 "2023-01-20T12:43:42Z")

</div>

do you want them to be draggable or just onclick?

```auto

	yourViewPath = "test" #change this to your view of th cricle thingy
	baseInstance = {
	  "position": "absolute",
	  "top": event.clientY,
	  "left": event.clientX,
	  "bottom": "auto",
	  "right": "auto",
	  "zIndex": "auto",
	  "width": "auto",
	  "height": "auto",
	  "viewPath": yourViewPath,
	  "viewParams": {},
	  "style": {
	    "classes": ""
	  }
	}
	self.props.instances = [baseInstance]

```

put this in the onclick

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/3/53ae71f37a6fb7af43662c093b82c39f44c19b97.png)

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 12:52pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/5 "2023-01-20T12:52:04Z")

</div>

just on clicking.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 12:53pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/6 "2023-01-20T12:53:12Z")

</div>

than the edit i just did to the post above should get you started 🙂

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/7 "2023-01-20T13:03:06Z")

</div>

thanks for the instance reply @victordcq i am new on ignition.  
let me try and will let you know.

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 1:10pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/8 "2023-01-20T13:10:25Z")

</div>

is this script i have to run on ROOT or Button event?  
i am confused.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 20, 2023, 1:13pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/9 "2023-01-20T13:13:18Z")

</div>

Select the canvas component, right click, then select configure events.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 1:17pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/10 "2023-01-20T13:17:14Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/3/b392381cdbe68237ff4e0e78707b38f7be65d339.png)

> [@victordcq](#):
>
> ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/3/53ae71f37a6fb7af43662c093b82c39f44c19b97.png)

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 1:20pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/11 "2023-01-20T13:20:58Z")

</div>

thanks @dkhayes117

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 1:23pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/12 "2023-01-20T13:23:47Z")

</div>

Thanks for supporting me @victordcq ,bwlow is the modified code.  
yourViewPath = "Button" #change this to your view of th cricle thingy  
baseInstance = {  
"position": "absolute",  
"top": event.clientY,  
"left": event.clientX,  
"bottom": "auto",  
"right": "auto",  
"zIndex": "auto",  
"width": "auto",  
"height": "auto",  
"viewPath": yourViewPath,  
"viewParams": {},  
"style": {  
"classes": ""  
}  
}  
self.props.instances = [baseInstance]

 ![Canvas](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/0/b0bee1090ee60b0d3350d78e507755c3a48c0a12.png)  
i have attached screen shot my screen .

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 1:29pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/13 "2023-01-20T13:29:36Z")

</div>

yourViewPath needs to be a view,

If you did not create a view named Button, this will not do anything.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/34c865578fa7d40afa101d6f94709531e4a202a9.png)

in this new view, you can put your button or the circle thing or whatever

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/14 "2023-01-20T13:49:05Z")

</div>

i have created new view (i.e test) after that dragged view canvas in that and added button on the view canvas.  
your script added on the view canvas .  
but same error .

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [January 20, 2023, 2:09pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/15 "2023-01-20T14:09:59Z")

</div>

The main view has the canvas with script, the test view has something you want to show at the position that is clicked in the main view...

- mainview

- test

---

<div class="post-metadata">

**Author:** ![kiran\_kale](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kiran\_kale](https://forum.inductiveautomation.com/u/kiran_kale)\
**Post date:** [January 20, 2023, 2:49pm UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/16 "2023-01-20T14:49:47Z")

</div>

thank you @victordcq for your Instance support.  
i appreciated you work.  
because of you i got the solution.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 8, 2025, 10:14am UTC](https://forum.inductiveautomation.com/t/read-the-coordinates-in-perspective/68845/17 "2025-03-08T10:14:40Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).
