# how to convert physical coordinate to world coordinate

**URL:** https://discourse.vtk.org/t/how-to-convert-physical-coordinate-to-world-coordinate/13276
**Category:** Support
**Created:** [February 7, 2024, 2:08am UTC](https://discourse.vtk.org/t/how-to-convert-physical-coordinate-to-world-coordinate/13276 "2024-02-07T02:08:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zhou](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/3e96dc/32.png) [@zhou](https://discourse.vtk.org/u/zhou)
#### Post date: [February 7, 2024, 2:08am UTC](https://discourse.vtk.org/t/how-to-convert-physical-coordinate-to-world-coordinate/13276/1 "2024-02-07T02:08:26Z")

</div>

Hi everyone!  
Now I have a .stl file ,I need to get the vertex under the world coordinate.

---

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [February 7, 2024, 1:20pm UTC](https://discourse.vtk.org/t/how-to-convert-physical-coordinate-to-world-coordinate/13276/2 "2024-02-07T13:20:02Z")

</div>

Greetings, zhou, welcome to the group.

In general, the more information you can give us about what you are doing, and how you are doing it, the better the answers you’re likely to get. For instance, a code snippet may help readers to get you going towards a solution more quickly.

I’m assuming that you are reading your STL file in with `vtkSTLReader`, and that you have the output data object (an instance of `vtkPolyData`). One possible way to get the node ID of the closest node to a given location in “world” coordinates would be to use `vtkStaticPointLocator`. Here is a sketch of what that might look like in Python:

```python
import vtk

r = vtk.vtkSTLReader()
r.SetFileName("nameofyourfile.stl")
r.Update()
pd = r.GetOutput()

h = vtk.vtkStaticPointLocator()
h.SetDataSet(pd)
h.BuildLocator()

# Find the node id of the node closest to the point (1, 2, 3) in "real" space.
node_idx = h.FindClosestPoint(1, 2, 3)

```

---

<div class="post-metadata">

### Author: ![zhou](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/3e96dc/32.png) [@zhou](https://discourse.vtk.org/u/zhou)
#### Post date: [March 12, 2024, 6:57am UTC](https://discourse.vtk.org/t/how-to-convert-physical-coordinate-to-world-coordinate/13276/3 "2024-03-12T06:57:28Z")

</div>

Thanks for your reply.
