+ Reply to Thread
Results 1 to 7 of 7

Thread: Query

  1. #1
    Yassine EL JADIDI
    Join Date
    Mar 2012
    Posts
    69
    Points
    0
    Answers Provided
    0


    0

    Default Query

    Hi,
    I want a code that show points with a query.
    for example, i want to show cities(points) where population >200 000 .
    Please can anyone help me ?
    Thanks

  2. #2
    Dominique BROUX

    Join Date
    Jan 2010
    Posts
    2,409
    Points
    743
    Answers Provided
    130


    0

    Default Re: Query

    The easiest way is to use a feature layer with a where clause (sample).
    You can also manage the query by yourself, see others query samples.
    /Dominique

  3. #3
    Yassine EL JADIDI
    Join Date
    Mar 2012
    Posts
    69
    Points
    0
    Answers Provided
    0


    0

    Default Re: Query

    Thank you dominique,
    how can i use a feature with a where clause ??
    and for query samples....i dont find a query about a feature layer (point)...i found just for polygons !!
    can you give me an example of a query ?

  4. #4
    Dominique BROUX

    Join Date
    Jan 2010
    Posts
    2,409
    Points
    743
    Answers Provided
    130


    0

    Default Re: Query

    how can i use a feature with a where clause ??
    Did you look at the sample I pointed out?
    In this sample, the feature layer is defined in XAML with a where clause:
    Code:
        <esri:FeatureLayer ID="AttributeFilterFeatureLayer"
                        Url="http://sampleserver1.arcgisonline.co...SA/MapServer/0" 
                        Where="POP1990 > 1000000" Renderer="{StaticResource MySimplePointRenderer}" >
        </esri:FeatureLayer>

    and for query samples....i dont find a query about a feature layer (point)...i found just for polygons !!
    There is not that much difference between polygon and point, you have just to replace the fill symbol by a marker symbol.

    For example in this sample, the impacted lines are:

    Code:
                   // Highlight selected feature
                    selectedFeature.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; 
                    graphicsLayer.Graphics.Add(selectedFeature);
    /Dominique

  5. #5
    Yassine EL JADIDI
    Join Date
    Mar 2012
    Posts
    69
    Points
    0
    Answers Provided
    0


    0

    Default Re: Query

    Thank you,
    its a good idea to use a feature layer with a where clause , but i want that the user who tape the condition (clause where).
    for example i want that the user have a textbox and he enter the condition ...any idea ?

  6. #6
    Jennifer Nery

    Join Date
    May 2010
    Posts
    2,449
    Points
    289
    Answers Provided
    51


    0

    Default Re: Query

    Sure, you can subscribe to TextBox.KeyUp event (Key.Enter) or maybe on a Button.Click event, you can set Where clause by using the Text value.

    For example;
    Code:
    var l = MyMap.Layers["MyFeatureLayer"] as FeatureLayer;
    l.Where = string.Format("FieldName = '{0}'", MyTextBox.Text);
    l.Update(); //to re-query the service applying the where clause.
    Jennifer Nery
    Software Developer
    ArcGIS API for SL/WPF/WP7

  7. #7
    Yassine EL JADIDI
    Join Date
    Mar 2012
    Posts
    69
    Points
    0
    Answers Provided
    0


    0

    Default Re: Query

    Thank you too much,
    i will try it

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts