Create a definition expression on a feature collection

1506
5
Jump to solution
06-26-2018 12:25 PM
JacobTodd3
New Contributor

Hi,

I am wondering if it is possible to create a definition expression on a feature layer that was created from a feature collection (or JSON). I have modeled part of my application after this sample on for version 4x:

ArcGIS API for JavaScript Sandbox 

After setting the definition expression and then printing out the feature layer (console.log), I can see in the meta data that a definition expression has been set, but it just doesn't display on the map.

Can anyone provide me with an explanation to this behavior? I have also reproduced the same results in the above sample sandbox.

Thanks,

Jacob

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

From the FeatureLayer documentation

Known Limitations

Definition expressions will not be honored when working with FeatureLayers created from client-side graphics.

View solution in original post

0 Kudos
5 Replies
KenBuja
MVP Esteemed Contributor

From the FeatureLayer documentation

Known Limitations

Definition expressions will not be honored when working with FeatureLayers created from client-side graphics.

0 Kudos
JacobTodd3
New Contributor

Hi Ken,

Thank you for your speedy response, although it is unfortunate that this is not supported.

Just a little bit more information for my reason for using client side graphics:

I am currently developing a SaaS based application that utilizes one primary feature class. I am returning the client side graphics via the REST API with C# which allows me to only return the logged in user's content.

To your knowledge, is there another way of going about this without the use of client side graphics as well as not exposing the user's information, such as their userid?

Thank,

Jacob

0 Kudos
KenBuja
MVP Esteemed Contributor

Unfortunately, I don't have a solution. You should probably ask this as a separate question to get a wider response (and mark this one as answered).

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

One solution I can think of is to loop through the graphics when you get them returned and set the ones that are not suppose to be visible to invisible by setting the visible property on the graphic.

0 Kudos
platmoskito
New Contributor II

it works now

0 Kudos