0

I'd like to show some informations in a popup, wherever the user has clicked.

The Query and QueryTask works, but every time the method for the query (MapMouseclick()) is done, it jumps into IdentifyQueryTaskFailed(). I have no idea why the execute failes every time. Here is my code:

Code-behind

private void Map_MouseClick(object sender, Map.MouseEventArgs e){
        QueryTask IdentifyQueryTask = new QueryTask("http://...");
        IdentifyQueryTask.ExecuteCompleted += new EventHandler<QueryEventArgs>(IdentifyQueryTask_ExecuteCompleted);
        IdentifyQueryTask.Failed += new EventHandler<TaskFailedEventArgs>(IdentifyQueryTask_Failed);

        Query identifyQuery = new Query();
        identifyQuery.Where = String.Format("geometry = {0},{1} and spatialReference = {2} and lower(Layers) = top and lower(Tolerance) = 50 and mapExtent = {3},{4},{5},{6} and imageDisplay = {7}, {8}, 96", e.MapPoint.X, e.MapPoint.Y, Map.Extent.SpatialReference.WKID, Map.Extent.XMin, Map.Extent.YMin, Map.Extent.XMax, Map.Extent.YMax, string.Format("{0:0}", Map.Extent.Width), string.Format("{0:0}", Map.Extent.Height), Map.Extent);
        identifyQuery.ReturnGeometry = true;
        identifyQuery.OutFields.Add("*");
        IdentifyQueryTask.ExecuteAsync(identifyQuery);
        MyPopup.IsOpen = false;
}


//This method executes never
void IdentifyQueryTask_ExecuteCompleted(object sender, QueryEventArgs e){
    TextBlockInPopup.Text = "successful";
    MyPopup.IsOpen = true;
}


void IdentifyQueryTask_Failed(object sender, TaskFailedEventArgs e){
    TextBlockInPopup.Text = "failed";
    MyPopup.IsOpen = true;
}

XAML

<Popup Name="MyPopup" ...>
    <TextBlock Name="TextBlockInPopup" Background="White"></TextBlock>
</Popup>

I'm using (ESRI API for) WPF and C# in Visual Studio 2010.


EDIT:

Here's the error message:

{Error code '500': 'Object reference not set to an instance of an object.' 'geometry' parameter not specified}

ArmandoS63
  • 693
  • 1
  • 6
  • 21

0 Answers0