Hi,
I'm using the Bookmarks widget, preloading bookmarks in the JavaScript code.
It works fine using type: extent:
new Bookmark({
name: "Test1",
viewpoint: {
targetGeometry: {
type: "extent",
xmin: -122.486,
ymin: 48.738,
xmax: -122.484,
ymax: 48.739
} } }),
But the scale isn't working for type: point:
new Bookmark({
name: "Test2",
viewpoint: {
targetGeometry: {
type: "point",
longitude: -122.488,
latitude: 48.73,
scale: ???
} } }),
How do I specify / use the scale parameter?
thanks,
~stefan (javascript beginner)
Solved! Go to Solution.
Hi Stefan,
The scale property needs to be set on the Viewpoint, not on the target geometry. See the example below:
const bookmark = new Bookmark({
name: "Test",
viewpoint: {
scale: 1600,
targetGeometry: {
type: "point",
longitude: -122.488,
latitude: 48.73
}
}
});
The following sample shows this same code in action on lines 55-66: https://codepen.io/laurenb14/pen/JjrEYmO?editors=1000
Hope that helps!
-Lauren
Hi Stefan,
The scale property needs to be set on the Viewpoint, not on the target geometry. See the example below:
const bookmark = new Bookmark({
name: "Test",
viewpoint: {
scale: 1600,
targetGeometry: {
type: "point",
longitude: -122.488,
latitude: 48.73
}
}
});
The following sample shows this same code in action on lines 55-66: https://codepen.io/laurenb14/pen/JjrEYmO?editors=1000
Hope that helps!
-Lauren
Thanks LaurenBoyd - exactly what I was looking for!