Hi,
I'm switching my layers over to hosted feature layers on our portal. I have a javascript map that consumes the data and presents the layer differently based on what user's select.
The way I'm currently doing it is changing the definitionExpression on the layer based on selection.
Now when I'm adding a layer from portalItem
Solved! Go to Solution.
The definitionExpression does work for your service. Looks like it is a really small road - https://codepen.io/U_B_U/pen/abMYXbG?editors=1000
Hi there,
That definitionExpression looks valid to me. Is it possible for you to shrare your data with me so I can take a look? The following example works.
const view = new MapView({
container: "viewDiv",
map: map,
center: [-122.907, 47.018],
zoom:12
});
const featureLayer = new FeatureLayer({
url: "https://data.wsdot.wa.gov/arcgis/rest/services/Shared/LocalAgencyPublicRoadData/FeatureServer/0",
definitionExpression: "RoadName = 'Columbia St NW'"
});
Thanks, @UndralBatsukh The code you showed is how I'm using it now. I'm wondering if using layers created from portal have the same capability of using the definitionExpression? See my code above. Thanks.
Here is an example layer, https://maps.hayward-ca.gov/portal/home/item.html?id=5663a61146c648ca9fd674b58693de47
The definitionExpression does work for your service. Looks like it is a really small road - https://codepen.io/U_B_U/pen/abMYXbG?editors=1000
Awesome. Thanks. Looks a lot simpler the way you are doing it. Perfect.