Select to view content in your preferred language

reg : QueryTask

746
3
09-15-2010 09:44 PM
VikramS
Frequent Contributor
Hi all ,

I am using the sample code for Map tips . I am not getting any features in the output . I am not getting any exception . Can anyone tell me what might be the problem . Thanks
<Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <esriSymbols:SimpleFillSymbol x:Name="DefaultFillSymbol" Fill="#01FFFFFF" BorderBrush="#88000000" BorderThickness="2" />
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Background="White"  Extent="2426385.82386653,6896756.02189902,2556875.50043892,7042393.11248154">
            <esri:Map.Layers>
                <esri:ArcGISDynamicMapServiceLayer ID="BaseMapLayer"
                    Url="http://epps65335.campus.ad.utdallas.edu/ArcGIS/rest/services/CrimeAnalysis/MapServer/" />
                <esri:GraphicsLayer ID="MyGraphicsLayer" Initialized="GraphicsLayer_Initialized" />
            </esri:Map.Layers>
        </esri:Map>
<esri:ScaleBar x:Name="scale" Map="{Binding ElementName=MyMap}" Margin="5" DisplayUnit="miles" Foreground="black" HorizontalAlignment="Center" VerticalAlignment="Bottom" MapUnit="feet" />
       
        <Canvas HorizontalAlignment="Left" VerticalAlignment="Top" >
            <esriToolkit:MapTip x:Name="MyMapTip"  BorderBrush="#99000000"
                BorderThickness="1" Title="State Info" VerticalOffset="10"
                HorizontalOffset="10" Background="#DDFFFFFF" />
        </Canvas>
    </Grid>

Code Behind

Private Sub GraphicsLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
        query.OutFields.Add("*")
        'query.ReturnGeometry = True
        'query.Geometry = New ESRI.ArcGIS.Client.Geometry.Envelope()

        Dim queryTask As New QueryTask("http://epps65335.campus.ad.utdallas.edu/ArcGIS/rest/services/CrimeAnalysis/MapServer/14")
        AddHandler queryTask.ExecuteCompleted, AddressOf querytask_executed
        queryTask.ExecuteAsync(query)


    End Sub

    Private Sub querytask_executed(ByVal sender As Object, ByVal e As QueryEventArgs)
        Dim featureSet As FeatureSet = e.FeatureSet

        Dim graphicsLayer As ESRI.ArcGIS.Client.GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer)
        MyMapTip.GraphicsLayer = graphicsLayer

        If featureSet IsNot Nothing AndAlso featureSet.Features.Count > 0 Then
            For Each feature As Graphic In featureSet.Features
                feature.Symbol = DefaultFillSymbol
                graphicsLayer.Graphics.Add(feature)
            Next feature
        End If

    End Sub
0 Kudos
3 Replies
dotMorten_esri
Esri Notable Contributor
Does you query return any results in the first place?
Also I don't see any failed handler on the querytask to check for any request issues.
0 Kudos
VikramS
Frequent Contributor
No it doesn't return any thing . I am not getting any exception .. Hence i dunno whats going wrong .. Help needed . THanks
0 Kudos
YungKaiChin
Regular Contributor

Does the link actually work?

(I wasn't able to connect to the server/service, btw.)

0 Kudos