# vtkCoordinate getComputedWorldValue is inaccuracy

**URL:** https://discourse.vtk.org/t/vtkcoordinate-getcomputedworldvalue-is-inaccuracy/12873
**Category:** Web
**Tags:** code
**Created:** [December 9, 2023, 2:38pm UTC](https://discourse.vtk.org/t/vtkcoordinate-getcomputedworldvalue-is-inaccuracy/12873 "2023-12-09T14:38:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lizemin2016](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lizemin2016/32/5266_2.png) [@lizemin2016](https://discourse.vtk.org/u/lizemin2016)
#### Post date: [December 9, 2023, 2:38pm UTC](https://discourse.vtk.org/t/vtkcoordinate-getcomputedworldvalue-is-inaccuracy/12873/1 "2023-12-09T14:38:15Z")

</div>

I try to get the png image from canvas by canvas.toDataURL method, which canvas is obtained from renderWindows view, and then try to overlay the png image to online map，with extent from coordinate caculated by vtkCoordinate, as follows：

```auto
  const coordinateView = vtkCoordinate.newInstance();
  coordinateView.setRenderer(renderer);
  coordinateView.setCoordinateSystemToNormalizedDisplay();
  coordinateView.setValue(viewpt); //set viewpt to [0,0] and [1,1],means leftBotton corner and rightTop corner 
  const coordinateWorld = coordinateView.getComputedWorldValue(renderer);

```

but the result is always slightly different, I don’t know why. Many thanks to the person who provided the answer.  
the follow two pictures show the mesh display with edge in Paraview, the mesh boundary display as polyline geometry in map(Bold black line) and together the png image. The location of the polyline is very accurate, but while the png image is…

 ![微信截图_20231210001837](https://discourse.vtk.org/uploads/default/original/2X/8/8a5a70b86d2f74e87067e092220a0aa68ccd180b.jpeg)

 ![Snipaste_2023-12-10_17-18-48](https://discourse.vtk.org/uploads/default/original/2X/e/e895c822b51d0985eb0e0854ec80dc7e9d64c8e9.jpeg)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 11, 2023, 2:54pm UTC](https://discourse.vtk.org/t/vtkcoordinate-getcomputedworldvalue-is-inaccuracy/12873/2 "2023-12-11T14:54:32Z")

</div>

Hello,

It seems to me that you just need to set the grid parameters (origin, cell size, etc.) of the PNG image such that the red area matches the outline.

take care,

PC

---

<div class="post-metadata">

### Author: ![Thibault\_Bruyere](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thibault_bruyere/32/6585_2.png) [@Thibault\_Bruyere](https://discourse.vtk.org/u/Thibault_Bruyere)
#### Post date: [December 11, 2023, 4:49pm UTC](https://discourse.vtk.org/t/vtkcoordinate-getcomputedworldvalue-is-inaccuracy/12873/3 "2023-12-11T16:49:31Z")

</div>

Hello,  
Do you do a parallel projection when rendering?  
You can do it with this code `camera.setParallelProjection(true)`
