Select to view content in your preferred language

View goTo() with Point

609
0
03-06-2019 02:58 AM
MarkusÅfelt
New Contributor III

Hi,

Noticed that zooming with single Point with .goTo({ target: geometries }) does not work. If I have 2 Points in array of 'geometries' then zooming to target is working.

What I'm missing? a single Point does not have extent, is that the reason why zooming does not work?

I'm using same view.toGo() to Point, Polygon, Polyline -geometries and it is working fine but single Point does not zoom to the target.

I have attached demo of the problem. Press "Bounce to Berlin" -button to notice that zooming to target is not working. 

Using JS API 4.10.

UPDATE: Solved problem with check

if (geometries && geometries.length === 1 && geometries[0].type === 'point') {
view.goTo({
target: geometries,
scale: view.maxScale,
});

}

Br,

Markus

0 Kudos
0 Replies