In the 4.x version of ArcGIS API for JavaScript, the Bookmarks widget and bookmarks property apply only to a WebView. In 3.x, bookmarks could be used without a web map. Will Bookmarks be available for MapViews in 4.x?
It displays a list of bookmarks, which typically are defined inside the WebMap
Yes the easiest way to use the bookmark widget is to use a webmap that has bookmarks defined in it, but that does not prevent you from creating your own bookmarks collection manually in code and setting the Bookmarks widget bookmarks property to that collection. I have not seen a sample for this because the normal route is to use a webmap.
The WebStyleSymbol (2D) sample has the Bookmarks widget working with an esri/Map in place of esri/WebMap. The key is to initialize the Bookmark widget's bookmarks with an array of Bookmark objects; without that adding a bookmark fails silently.
I still claim the documentation implies WebMap is central to bookmarks functionality (Searching the API for "bookmarks", it looks like WebMap is at the root of Bookmarks. The only Bookmark class is esri/webmap/Bookmark. The only classes with a bookmarks property are the widget and WebMap. The Bookmark class and Bookmarks widget API pages both start off with "typically are defined inside the WebMap", but don't mention any other way to define them, and the sample linked from those pages uses a WebMap.)
Thank you for the question, which caused me to review and find two mistakes in my post. A less than thorough reading of API docs and sample code led me to believe the widget's view needed to derive from a WebMap (not a WebView, which I made up). I will give it a go.
What is a WebView?... In 4.x the Bookmark widget applies to 2D maps only (i.e. MapView). They currently do not work for SceneViews (as this is a know limitation).
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.