Select to view content in your preferred language

Query on map extension changed

454
2
06-29-2012 12:18 AM
IkerBerasaluce
Occasional Contributor
Hello,
I am trying to show the number of points visible in a textblock and change that number everytime the map extension is changed. So far I successfully queryed the map but while testing my code I found that if I go to full extent and then zoom to every point except one the number of points showed is the same. This is even weirder when you consider that most of my points are in southern Europe and the one left alone is in India. The code I am using is this:

    Private Sub MyMap_ExtentChanged(ByVal sender As Object, ByVal e As ExtentEventArgs)
 NumProyectosVisiblesMostrar()
    End Sub

    Private Sub NumProyectosVisiblesMostrar()
        Dim idpParametrosIdentificacionProyectos As ESRI.ArcGIS.Client.Tasks.IdentifyParameters
        Dim idtTareaIdentificacionProyectos As IdentifyTask
        Try

            idpParametrosIdentificacionProyectos = New IdentifyParameters() With {.Geometry = MyMap.Extent, .MapExtent = MyMap.Extent, .Width = CInt(Fix(MyMap.ActualWidth)), .Height = CInt(Fix(MyMap.ActualHeight)), .LayerOption = LayerOption.visible, .SpatialReference = MyMap.SpatialReference, .Tolerance = 0}
            idtTareaIdentificacionProyectos = New IdentifyTask(_strQSURLMapa3)

            AddHandler idtTareaIdentificacionProyectos.ExecuteCompleted, AddressOf idtTareaIdentificacionProyectos_ExecuteCompleted
            AddHandler idtTareaIdentificacionProyectos.Failed, AddressOf idtTareaIdentificacionProyectos_Failed
            idtTareaIdentificacionProyectos.ExecuteAsync(idpParametrosIdentificacionProyectos)
        Catch ex As Exception
            tbNumProyectos.Text = ""
        End Try
    End Sub

    Private Sub idtTareaIdentificacionProyectos_Failed(ByVal sender As Object, ByVal e As TaskFailedEventArgs)
        Try
            tbNumProyectos.Text = ""
        Catch ex As Exception
            tbNumProyectos.Text = ""
        End Try
    End Sub

    Private Sub idtTareaIdentificacionProyectos_ExecuteCompleted(ByVal sender As Object, ByVal args As IdentifyEventArgs)
        Try
            If args.IdentifyResults IsNot Nothing AndAlso args.IdentifyResults.Count > 0 Then
                tbNumProyectos.Text = args.IdentifyResults.Count.ToString
            Else
                tbNumProyectos.Text = "0"
            End If
        Catch ex As Exception
            tbNumProyectos.Text = ""
        End Try
    End Sub


Is something wrong with the way I am querying the map?
Thank you
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
I don't see something wrong in your code:confused:.

Is it working well when you zoom in to show a few points only?
0 Kudos
IkerBerasaluce
Occasional Contributor
Yes it does.
I am going to try using a QueryTask instead of a IdentifyTask, lets see if it works that way.
Thank you.
0 Kudos