Esri JS书签在单独的Div

时间:2014-11-24 19:22:41

标签: javascript arcgis arcgis-js-api

使用Esri JavaScript API我需要创建许多不同的书签,并通过单独的div标签中的HTML访问它们。我试图创建了这个JS Fiddle

我认为如果我定义了单独的书签和书签项目,它就可以了。还没有成功。我想我很亲密,错过了一些简单的事情/.

      var bookmark1 = new esri.dijit.Bookmarks({
      map: map, 
      bookmarks: Bookmark_1

    }, dojo.byId('Bookmark1'));

1 个答案:

答案 0 :(得分:0)

我不确定我是否理解你但是......试试这个:

脚本:

   require(['dojo/_base/declare', 'esri/map', "esri/dijit/Bookmarks", 'dijit/Dialog',
  'dijit/layout/BorderContainer', 'dijit/layout/ContentPane'], function (declare, Map, Bookmarks) {
      var map = new Map("map", {
          basemap: "satellite",
          center: [-70.302994, 41.700140],
          zoom: 10
      });

      bookmark = new Bookmarks({
          map: map,
          bookmarks: [],
          editable: true
      }, dojo.byId('bookmarks'));

      var bookmarkPA = {
          "extent": {
              "spatialReference": {
                  "wkid": 102100
              },
              "xmin": -8669334,
              "ymin": 4982379,
              "xmax": -8664724,
              "ymax": 4984864
          },
          "name": "Central Pennsylvania"
      };
      // bookmark.addBookmark(bookmarkCA);
      bookmark.addBookmark(bookmarkPA);

体:

<body>
<div id="leftPane">
    <div id="bookmarks"></div>
</div>

<div id="map"></div></body>

式:

    <style>
    body, html {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    #map {
        position: fixed;
        top: 0px;
        left: 400px;
        width: 100%;
        height: 100%;
        margin: 0px;
    }

    #leftPane {
        width: 400px;
        height: 100%;
        background-color: gray;
        overflow: scroll;
        border-color: #242222;
        border-width: 2px;
    }
</style>