JS API 4.X: ViewPoint.targetGeometry only works with Point

458
2
03-13-2019 04:18 PM
NicolasGIS
Occasional Contributor III

Hello,

I just noticed that the viewPoint.targetGeometry can only be a Point as it fails silently when it is a polygon or a polyline: 

Codepen 

Is it a bug or type definition error ?

Thanks

Tags (1)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Nicholas,

  That does seems like a bug. Though I am not sure why you would do that vs using goTo with the target of polygonGraphic.geometry and scale of 1000000?

      view.when().then(() => {
        view.goTo({
          target: polygonGraphic.geometry,
          scale: 1000000
        });
      });
0 Kudos
NicolasGIS
Occasional Contributor III

Hello Robert,

Thanks for the reply.

I am doing that because I have a function that depending on parameters return viewPoint accordingly.

I will use your workaround in the meantime.

Thanks !

0 Kudos