【问题标题】:Displaying popup on arcGIS map在 arcGIS 地图上显示弹出窗口
【发布时间】:2022-01-24 04:29:15
【问题描述】:

我有一个位置列表,如果用户单击它将定位并在弹出窗口中显示其详细信息,在我当前的行为中,如果我单击列表中的位置,它将找到它并出现弹出窗口。问题是弹出窗口没有显示详细信息或显示文本

const onLocationSelect = (location) => {
         let locationGraphics = [];
         let point = new Graphic({
         attributes: {
                 city: location.address.city,
                 name: location.name,
                 state: location.address.state,
                 street1: location.address.street1,
                 street2: location.address.street2,
                 zipCode: location.address.zipCode,
        },
    });
    location.point = point;
    locationGraphics.push(point);
    const result = LocationLayer.applyEdits({
              addFeatures: locationGraphics,
     }).then((results) => {
     if (results) {
           mapDiv.current.goTo(location).then(() => {
           mapDiv.current.popup.open({
                   features:location,
                   location:[
                             location.geoCode.longitude,
                             location.geoCode.latitude,
                   ]
           })
       })
       }
    });
  }

资源

https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

【问题讨论】:

    标签: javascript reactjs arcgis esri


    【解决方案1】:

    这样做,

    point.popupTemplate = {
      content: [{
        type: "text", // Autocasts as new TextContent
        text: "The {expression/predominance-tree} species occurs more often"
          + " than other tree species in the area."
      }]
    };
    

    然后

    features:[point]

    【讨论】:

      猜你喜欢
      • 2015-11-28
      • 2015-05-27
      • 1970-01-01
      • 2012-11-15
      • 1970-01-01
      • 1970-01-01
      • 2020-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多