簡體   English   中英

使用ArcGIS API for JavaScript從表中選擇行時,如何從要素圖層彈出彈出模板?

[英]Getting popuptemplate from feature layer to pop up when selecting row from table using ArcGIS API for JavaScript?

在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
    });
}

單擊地圖上的某個要素時,我將彈出一個包含該要素值的彈出窗口。 很好

還有一個表,在地圖上每個要素都有一行。

單擊表行時,我將執行以下代碼,並將該功能的經緯度傳遞給它:

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。 就像我單擊該功能會發生什么。

根據文檔https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open,您必須指定-以及位置-彈出窗口的標題和內容,或所選點的特征。

this.view.popup.open({ location: this.view.center, title: 'foo', content: 'bar' });

要么

this.view.popup.open({ location: this.view.center, features: [selectedGraphic]});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM