如何从导出的Tileset获取所查询要素的feature_id

问题描述

MapBox数据集功能具有unique generated IDs feature_id。可以从创建为该数据集导出的Tileset中获得此map.addSource('roads',{ type: 'vector',url: 'mapBox://user.t9c4q9043xd4rd5209592740953-2icq9',// Tileset }); map.on('click',(e) => { const features = map.queryRenderedFeatures(e.point,{ layers: ['my-layer-name'],}); for (const feature of features) { console.log(feature); // there is no feature_id inside } }); 吗?

feature_id

我还尝试直接使用包含那些map.addSource('roads',{ type: 'geojson',data: 'https://api.mapBox.com/datasets/v1/user/t9c4q9043xd4rd5209592740953/features?access_token=pk.xxxxx',// Dataset }); map.on('click',}); for (const feature of features) { console.log(feature); // there is no feature_id inside } }); 的数据集GeoJSON,但无法使用JS API访问它。

<MapBoxGL.MapView   
        style={styles.map} 
        rotateEnabled>

          <MapBoxGL.RasterSource {...rasterSourceProps} >
                <MapBoxGL.BackgroundLayer id="background"  sourceLayerID="iranMap" style={{ backgroundColor:"#f2efea"} } />
                <MapBoxGL.RasterLayer
                    id="iranMapLayer"
                    sourceLayerID="iranMap"
                    minZoomLevel= {1}
                    maxZoomLevel= {19}   
                    style={{rasterOpacity: 1,rasterFadeDuration: 100}}               
                />           
          </MapBoxGL.RasterSource>
          <MapBoxGL.Camera zoomLevel={3} centerCoordinate={coordinates} />
          <MapBoxGL.PointAnnotation coordinate={coordinates} id="Test" />        
        </MapBoxGL.MapView>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)