|
POST
|
Update: I tied the GetResultDataAsync to the onclick event of a button and specified the jobID of a know job that has results in the server jobs folder. When I click the button nothing happens. I had fiddler running so I could see if a request was being sent. Nothing shows in fiddler. I am not sure why GetResultDataAsync is not firing at all.
Geoprocessor geoprocessorTask = sender as Geoprocessor;
geoprocessorTask.GetResultDataCompleted += GeoprocessorTask_GetResultDataCompleted;
geoprocessorTask.Failed += GeoprocessorTask_Failed;
geoprocessorTask.GetResultDataAsync("j0ecca8fcfee3406ba977cb29b53d09dd", "output"); I put in some exception handling in my code to see what is going wrong. I get an "object reference not set to an instance of an object" in this code.
foreach (GPParameter gpParameter in e.Results.OutParameters)
{
GPFeatureRecordSetLayer gpLayer = gpParameter as GPFeatureRecordSetLayer;
foreach (Graphic graphic in gpLayer.FeatureSet.Features)
{
graphicsLayer.Graphics.Add(graphic);
}
}
... View more
05-24-2012
06:59 AM
|
0
|
0
|
1969
|
|
POST
|
Hi dbroux, I already have MessageBox.Show(e.JobInfo.JobStatus.ToString()); in my code for Geoprocessor_JobCompleted and it shows the esriJobSucceeded message. I have messageboxes in my GeoprocessorTask_GetResultDataCompleted so it will show me when that completes but I never get anything. Here is my output parameter which does not look like an issue to me. Parameter: output Data Type: GPRecordSet Display Name: output Direction: esriGPParameterDirectionOutput Default Value: Parameter Type: esriGPParameterTypeRequired Category: Thanks for your response.
... View more
05-24-2012
06:40 AM
|
0
|
0
|
2047
|
|
POST
|
Well I am not having much luck. I can't seem to retrieve my results from the GP Task. The GP Task runs fine and I do see the results in the jobs folder on the server. I then attempt to run a GetResultDataAsync to get the GPFeatureRecordSetLayer but it is getting hung up. It seems like my geoprocessorTask.GetResultDataCompleted is not firing as the completed or failed events never get triggered. Anyone see anything wrong in my code? This is the first time I try an Asynchronous request so there is verywell some user error involved here. I use the samples as a guide.
private void Geoprocessor_JobCompleted(object sender, JobInfoEventArgs e)
{
Geoprocessor geoprocessorTask = sender as Geoprocessor;
geoprocessorTask.GetResultDataCompleted += GeoprocessorTask_GetResultDataCompleted;
geoprocessorTask.Failed += GeoprocessorTask_Failed;
geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "output");
}
private void GeoprocessorTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
{
GraphicsLayer graphicsLayer = MapApplication.Current.Map.Layers["MyResultGraphicsLayer"] as GraphicsLayer;
GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
MessageBox.Show(gpLayer.FeatureSet.Count().ToString());
foreach (Graphic graphic in gpLayer.FeatureSet.Features)
{
graphicsLayer.Graphics.Add(graphic);
}
MessageBox.Show(graphicsLayer.Count().ToString());
this.dg.GraphicsLayer = graphicsLayer;
btnPoint.IsEnabled = true;
}
private void GeoprocessorTask_Failed(object sender, TaskFailedEventArgs e)
{
MessageBox.Show("Geoprocessing service failed: " + e.Error);
btnPoint.IsEnabled = true;
}
... View more
05-24-2012
06:12 AM
|
0
|
0
|
2047
|
|
POST
|
GraphicsLayer does not need to be part of map if there is no geometry. I did not know this. That should clear everything up. I will give it a try. Thanks!!!
... View more
05-23-2012
12:23 PM
|
0
|
0
|
2047
|
|
POST
|
It does require input and I have already used Fiddler to verify the rquest I am sending is correct. I changed my execution type to asynchronous now so I can see my results on the server. I am now trying to update my web app to use this service. I am stuck on the part you mentioned about the GPFeatureRecordSetLayer. I see examples on how to iterate the recordset to add as graphics. I just can't seem to figure out how to iterate the records to add to a list so I can populate a table since what i am returning are just statistics that will display in a report. GPFeatureRecordSetLayer gpLayer = e.Parameter as GPFeatureRecordSetLayer;
foreach (Graphic graphic in gpLayer.FeatureSet.Features)
{
}
... View more
05-23-2012
09:41 AM
|
0
|
0
|
2047
|
|
POST
|
Hi Jennifer- Thanks for the reply. When i run from the rest enpoint to the %SCRATCHWORKSPACE% i get results but they disappear from the jobs folder to check what is in the results table. I changed the output of the service to a dbf temporarily and I see my results fine. I get the messages seen below when running the gp fom rest. The gp service is synchrounous so the execute should be fine. I belive you are right with the GPFeatureRecordSetLayer. How do I go about that? Results: Messages: �?� esriJobMessageTypeInformative: Executing (HailAnalysis): HailAnalysis "Feature Set" "100 Miles" �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:24 2012 �?� esriJobMessageTypeInformative: Executing (Buffer): Buffer "Feature Set" D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\Buffer.shp "100 Miles" FULL ROUND NONE # �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:24 2012 �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:25 2012 (Elapsed Time: 1.00 seconds) �?� esriJobMessageTypeInformative: Executing (Clip): Clip D:\agsResources\ArcSDE.sde\ArcSDE.A10ID.HailClaims D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\Buffer.shp D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip.shp # �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:25 2012 �?� esriJobMessageTypeInformative: Reading Features... �?� esriJobMessageTypeInformative: Cracking Features... �?� esriJobMessageTypeInformative: Assembling Features... �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:25 2012 (Elapsed Time: 0.00 seconds) �?� esriJobMessageTypeInformative: Executing (Summary Statistics): Statistics D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip.shp D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip_Statistics.dbf "LossAmt MEAN;ExpAmt MEAN;LossAmt SUM;ExpAmt SUM" LossDt �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:25 2012 �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:25 2012 (Elapsed Time: 0.00 seconds) �?� esriJobMessageTypeInformative: Executing (Sort): Sort D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip_Statistics.dbf D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip_Statistics_S.dbf "FREQUENCY DESCENDING" UR �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:25 2012 �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:25 2012 (Elapsed Time: 0.00 seconds) �?� esriJobMessageTypeInformative: Executing (Table Select): TableSelect D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\HailClaims_Clip_Statistics_S.dbf D:\arcgisserver\arcgisjobs\gptools_gpserver\j1ef0965a68274e9e8f798b023f3ea66e\scratch\scratch.gdb\Ouput "OID >= 5" �?� esriJobMessageTypeInformative: Start Time: Wed May 23 11:06:25 2012 �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:26 2012 (Elapsed Time: 1.00 seconds) �?� esriJobMessageTypeInformative: Succeeded at Wed May 23 11:06:26 2012 (Elapsed Time: 2.00 seconds)
... View more
05-23-2012
08:48 AM
|
0
|
0
|
2047
|
|
POST
|
Hi- I created a geoprocessing service that outputs a table in the scratch GDB. I am trying to retrieve the results to diplay in a datagrid but I am having issues. I have tried many methods with no luck. Below I try to count the outparameters but it is always 0. Does anyone know how to retruieve the table data? private void GeoprocessorTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.GPExecuteCompleteEventArgs args) { btnPoint.IsEnabled = true; MessageBox.Show(args.Results.OutParameters.Count().ToString()); } Thanks!
... View more
05-23-2012
08:01 AM
|
0
|
16
|
7561
|
|
POST
|
The first thing you need to learn is how to create/deploy a custom layout. This link, Creating a Custom Layout, explains that process. You can place my code in different locations depending on where in the map you would like to see the measuring control panel. I used the accordian layout as my starting template. Create a copy of the accordian.xaml and name it whaterver you want. For my example You should find the area around line 571 that startes esri:map. This is where I implement my custom tools. Here is my code expanded a little so you can see where I implemented it. I actually have 2 tools in here. One is the measurinf tools and the other is a tranparency slide that changes the transparency of the selected layer. I changed both items to Visible so they will always show for you. You can take a look at the viewer help and samples for instructions to create a toggle to turn these on and off using an add-in. I'll be glad to answer any questions if I can. <esri:Map x:Name="Map" HorizontalAlignment="Stretch" IsLogoVisible="False" VerticalAlignment="Stretch"
Grid.ColumnSpan="2" Grid.RowSpan="3" WrapAround="True"
d:DataContext="{Binding Converter={StaticResource SampleGraphicsLayerConverter}, RelativeSource={RelativeSource Self}}"/>
<Grid Grid.Column="{Binding ElementName=SidePanelContainer, Path=Visibility, Converter={StaticResource VisibilityToIntConverter}}"
Grid.ColumnSpan="{Binding ElementName=SidePanelContainer, Path=Visibility, Converter={StaticResource VisibilityToIntConverter}, ConverterParameter='1,2'}" Grid.RowSpan="{Binding Visibility, ConverterParameter=1\,2, Converter={StaticResource VisibilityToIntConverter}, ElementName=FeatureDataGridContainer}">
<esri:MapProgressBar Map="{Binding ElementName=Map}" Width="250" Height="35" Style="{StaticResource MapProgressBarStyle}" Margin="10,5,0,2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
<ContentControl x:Name="ScaleBarContainer"
Margin="20,0,0,2"
HorizontalAlignment="Left"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Bottom"
Foreground="WhiteSmoke">
<ContentControl.Effect>
<DropShadowEffect BlurRadius="10" ShadowDepth="2" Opacity="1" Direction="300" />
</ContentControl.Effect>
</ContentControl>
<ContentControl x:Name="AttributionDisplayContainer"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Margin="0,0,6,2"/>
<!--Measuring Tools-->
<Grid x:Name="MeasureBox" HorizontalAlignment="Right" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" Visibility="Visible">
<Border Style="{StaticResource GlassyBorder}" Padding="10,3,10,3" Opacity="1">
<!--<Border.Effect>
<DropShadowEffect />
</Border.Effect>-->
<StackPanel >
<TextBlock Text="Measuring Tools" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
<TextBlock Text="Select Units:" Foreground="White" FontSize="12" Margin="2" />
<ComboBox x:Name="UnitCombo" Foreground="White" Margin="0,0,0,4" >
<ComboBox.Items>
<ComboBoxItem Content="Feet" IsSelected="True" Foreground="Black"/>
<ComboBoxItem Content="Meters" Foreground="Black"/>
<ComboBoxItem Content="Miles" Foreground="Black"/>
</ComboBox.Items>
</ComboBox>
<ComboBox x:Name="AreaCombo" Foreground="White">
<ComboBox.Items>
<ComboBoxItem Content="SquareFeet" IsSelected="True" Foreground="Black"/>
<ComboBoxItem Content="SquareMeters" Foreground="Black"/>
<ComboBoxItem Content="SquareMiles" Foreground="Black"/>
</ComboBox.Items>
</ComboBox>
<Rectangle Margin="0,10,0,10" Fill="White" Height="2" HorizontalAlignment="Stretch" />
<Button Margin="0,0,0,2"
Content="Length(Line)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Polyline"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="0,2,0,2"
Content="Radius(Circle)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Radius"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="0,2,0,2"
Content="Area(Polygon)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Polygon"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</Border>
</Grid>
<!--Transparency Slider-->
<Grid x:Name="TransparencyBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" Visibility="Visible">
<Border Style="{StaticResource GlassyBorder}" Padding="10,3,10,3" Opacity="1">
<!--<Border.Effect>
<DropShadowEffect />
</Border.Effect>-->
<StackPanel Background="Transparent" Margin="0,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock Text="Layer Transparency" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
<Slider Height="23" Width="100" Name="slider1" Minimum="0" Maximum="1" Value="{Binding Path=SelectedLayer.Opacity, Mode=TwoWay, Source={StaticResource MapApplication}}" IsDirectionReversed="False" />
</StackPanel>
</Border>
</Grid>
</Grid>
... View more
05-17-2012
04:38 AM
|
0
|
0
|
1098
|
|
POST
|
I am having an issue with the Auto Update settings in the Viewer. I set all the appropriate auto update settings for all my layers ranging from 2 mnute to 10 minute updates. I publish the map and everything works as planned. If I go back into the viewer to make a change, randomly a layers auto update will be change back to the default 30 second update. There is no rhyme or reason why it does this or what layer it does this on. Now everytime I go in to make a change, before I publish, I have to go into to the configuratyion of every layer to make sure the settings are correct. Not fun... Is this a known bug? Thanks..
... View more
05-15-2012
05:21 AM
|
0
|
0
|
515
|
|
POST
|
I have developed a measuring tool by utilizing a custom layout template. I went this route because I liked the functionality of seeing the measurements on individual line segments. I also created a quick add-in that allows the Measuring Panel to be opened and closed but it is not necesary. Yuo can change the visibility of the MeasureBox Data Grid to Visible and it will remian open all the time. I've included a picture of this tool. [ATTACH=CONFIG]14300[/ATTACH] Custom Layout Measuring Code <Grid x:Name="MeasureBox" HorizontalAlignment="Right" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="10" Visibility="Collapsed">
<Border Style="{StaticResource GlassyBorder}" Padding="10,3,10,3" Opacity="1">
<StackPanel >
<TextBlock Text="Measuring Tools" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
<TextBlock Text="Select Units:" Foreground="White" FontSize="12" Margin="2" />
<ComboBox x:Name="UnitCombo" Foreground="White" Margin="0,0,0,4" >
<ComboBox.Items>
<ComboBoxItem Content="Feet" IsSelected="True" Foreground="Black"/>
<ComboBoxItem Content="Meters" Foreground="Black"/>
<ComboBoxItem Content="Miles" Foreground="Black"/>
</ComboBox.Items>
</ComboBox>
<ComboBox x:Name="AreaCombo" Foreground="White">
<ComboBox.Items>
<ComboBoxItem Content="SquareFeet" IsSelected="True" Foreground="Black"/>
<ComboBoxItem Content="SquareMeters" Foreground="Black"/>
<ComboBoxItem Content="SquareMiles" Foreground="Black"/>
</ComboBox.Items>
</ComboBox>
<Rectangle Margin="0,10,0,10" Fill="White" Height="2" HorizontalAlignment="Stretch" />
<Button Margin="0,0,0,2"
Content="Length(Line)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Polyline"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="0,2,0,2"
Content="Radius(Circle)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Radius"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="0,2,0,2"
Content="Area(Polygon)" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:MeasureAction
AreaUnit="{Binding ElementName=AreaCombo, Path=SelectedItem.Content}"
DisplayTotals="True"
DistanceUnit="{Binding ElementName=UnitCombo, Path=SelectedItem.Content}"
MapUnits="Meters"
MeasureMode="Polygon"
FillSymbol="{StaticResource DefaultFillSymbol}"
TargetName="Map"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</Border>
</Grid> Code in Add-In to toggle toll on/off Measuring tool in layout. namespace MeasurementTool.AddIns
{
[Export(typeof(ICommand))]
[DisplayName("Measuring Tools")]
[ESRI.ArcGIS.Client.Extensibility.Description("Click to show or hide measuring tools.")]
public class ToggleLayoutObject : ICommand
{
private FrameworkElement objectToToggle;
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
if (objectToToggle == null)
objectToToggle = MapApplication.Current.FindObjectInLayout("MeasureBox") as FrameworkElement;
if (objectToToggle != null)
objectToToggle.Visibility = objectToToggle.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
}
}
}
... View more
05-14-2012
05:50 AM
|
0
|
0
|
2790
|
|
POST
|
Craig- Do you happen to know if it keeps the same orange glow affect when selecting the items? Thanks.
... View more
04-27-2012
11:21 AM
|
0
|
0
|
2166
|
|
POST
|
2. Find the differences in a python set. This is the fastest by a long way (milliseconds for the whole thing). The catch is that you still have to read the tables once each to make the sets and write out a selected set. But it will still be less than minute or two. This sounds like an ideal chioce for me but as I said my python experience is limited. Do you happen to know of any samples that show how to populate a set from a table in sde? Thanks!
... View more
04-24-2012
06:40 AM
|
0
|
0
|
952
|
|
POST
|
I am new to python so I am working through a comparison script that will let me know if there are any differences between an mdb and a feature class (FC). Both tables with contain roughly 500,000 records. When comparing it takes probably 30 seconds for each record to find a match. I find this method to be extremely slow and I still need to add another match field. Is there a better way to compare the tables? Eventually my end result will: Remove records from the FC that are no longer in the mdb table. If the recor in the mdb is newer (based on comparing time stamp field) the FC record will be removed. Any records not found or that have newer data than FC will be added to a table in my SDE database that is dynamically geocoded back to the FC.
# Import system modules
import arcpy, os
desc = arcpy.Describe
# Local variables:
table = "D:/HOPOLICIES/Test.mdb/tblHOPolicies"
fc = "Database Connections\\ArcSDE.sde\\ArcSDE.A10713.HOPolicies_NW"
cField = "Policy_Number"
rows = arcpy.SearchCursor(table)
row = rows.next()
while row:
tableValue = row.getValue(cField)
rows2 = arcpy.SearchCursor(fc)
row2 = rows2.next()
while row2:
fcValue = row2.getValue(cField)
if tableValue == fcValue:
print tableValue + " Match Found to " + fcValue
break
row2 = rows2.next()
row = rows.next()
... View more
04-23-2012
12:03 PM
|
0
|
4
|
1722
|
|
POST
|
Well i decided to make my own symbol using the ControlTemplate and visual states. I would love to be able to recreate the same orange glow used for selected items. Would anyone at ESRI be able to provide the code used for the symbol animation?
... View more
04-13-2012
07:37 AM
|
0
|
0
|
2166
|
|
POST
|
Well after spending a day trying to get past this I am baffled. I did notice that if I use my add-in with custom symbology to add a graphics layer and then change the symbology using congiguration tool, the highlighted when selecting comes back. I can't figure out a way to reference the build in symbology from an add-in. I willing to try any ideas you may have.. Thanks.
... View more
04-12-2012
11:11 AM
|
0
|
0
|
2166
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 03-12-2025 11:01 AM | |
| 3 | 01-08-2025 09:26 AM | |
| 1 | 01-08-2025 07:19 AM | |
| 1 | 12-06-2024 04:52 AM | |
| 2 | 03-19-2024 04:36 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|