The JMap layer id
Optional
params: JGetSourceFeaturesParamsan optional JGetSourceFeaturesParams object
Error if layer is not found
Error any invalid parameter is passed
const viewPort = JMap.Geometry.getPolygonFeature({
type: "Polygon",
coordinates: [
[
[ 20.44, 10.32 ],
[ 20.44, 78.44 ],
[ 40.56, 78.44 ],
[ 40.56, 10.32 ],
[ 20.44, 10.32 ]
]
]
})
const features = JMap.Map.getSourceFeatures(1, {viewport: viewport})
console.log("features for layer id=1 :" , features)
JMap.Map.getSourceFeatures
Returns geojson features for the specified JMap layer whether or not they are currently rendered by the map (i.e. whether or not they are filtered on screen)
If the JMap layer is not visible, no features are returned.
The map splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features). By default, getSourceFeatures will only return one of those pieces (a random one). If you pass a JGetSourceFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getSourceFeatures. If you pass a JGetSourceFeaturesParams with keepAllTiles = false (or if keepAllTiles is not specified), and if a viewport is specified in the JGetSourceFeaturesParams, the sole feature piece returned is garanteed to be included in the viewport.