使用ArcGIS API for JavaScript从表中选择行时,从要素图层弹出模板是否会弹出?

时间:2018-02-21 22:33:00

标签: javascript popup esri-javascript-api

在Angular 2应用程序中使用esri javascript api 4.3。 我最初使用以下代码生成地图:

ngOnInit() {

    this.map = new Map({
        basemap: 'streets',
    });

    this.map.layers.add(new FeatureLayer({
        url: 'http://test/arcgis/rest/services/Project_map/MapServer/0', 
        id: '0',
        visible: true,
        outFields: ["*"],
        popupTemplate: this.jobsTemplate
    }));

    this.view = new MapView({
        container: "viewDiv",
        map: this.map,
        center: new Point({
            x: -111.876,
            y: 40.758,
        }),
        zoom: 12,
        rotation: 0
    });
}

当点击地图上的某个功能时,我会弹出一个包含该功能值的弹出窗口。这很好。

还有一个表格,地图上的每个要素都有一行。

当单击一个表行时,我执行以下代码,将该特征传入lat和long:

zoomToPoint(zoomLong: number, zoomLat: number) {
    this.view.center = new Point({ x: zoomLong, y: zoomLat });
    this.view.zoom = 15;
    this.view.popup.open({ location: this.view.center });
}

我在正确的位置弹出一个窗口。但是,弹出窗口是空的 我希望它使用分配给要素图层的popupTemplate,并包含该位置的要素值。就像我点击该功能时会发生什么。

1 个答案:

答案 0 :(得分:0)

根据文档https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open,您必须指定-along与位置 - 弹出窗口的标题和内容,或所选点的功能。

\t

\x09