|
POST
|
arcpy.CalculateField_management(workTable, 'Date', "datetime.datetime.today()- datetime.timedelta(days=1)", "PYTHON")
This works. I just thought i would be able to use my requestDate variable as it is performing the exact same function.
... View more
10-15-2012
11:55 AM
|
0
|
0
|
476
|
|
POST
|
I am creating a script that downloads a file from the previous day and add the contents to a temp gdb. Then I am trying to add a field for the Date the file is from. I can't seem to calculate the date correctly when running CalculateField. I have tried numerous ways resulting in error, incorrect dates, or just the time showing. The code below give me an incorrect date. leaving off the str before the requestDate gives me an Object: Error in Executing tool. Any ideas?
requestDate = date.today() - timedelta(days=1) #Current day - 1 day
importpath = "C:\\PythonScripts\\ProcessLiveHail\\Work\\"
workGDB = importpath + 'WorkDB.gdb'
try:
if os.path.exists(workGDB):
arcpy.Delete_management(workGDB)
arcpy.CreateFileGDB_management(importpath, "WorkDB.gdb")
arcpy.CopyFeatures_management(importpath + 'hailsize_' + requestDate.strftime("%Y%m%d") + '.shp', workTable)
arcpy.AddField_management(workTable, 'Date', "DATE")
arcpy.CalculateField_management(workTable, 'Date', str(requestDate), "PYTHON")
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
print e.message
... View more
10-15-2012
11:23 AM
|
0
|
1
|
2491
|
|
POST
|
Thanks Douglas. How do i assiggn myPOint to the one record in my feature layer? I have tried using the methods you mention but can't seem to pass hte correct data to get it to work properly.
... View more
10-12-2012
12:11 PM
|
0
|
0
|
930
|
|
POST
|
I am new to javascript and am looking for a little guidance as to zooming to a single point in a feature layer. I am adding a layer to my map that will only have 1 record based on an input field. I would like to center and zoom to that point when the app initializes and then when someone changes the value and clicks submit. For the life of me I can figure out how to zoom to the point that is in that layer. Here is my code to add the layer. Any suggestions? I've tried many things including querying the layer and zooming to the extent of the results with no luck. Please help.
HOPolicies = new esri.layers.FeatureLayer("http://webmapping/ArcGIS/rest/services/Policies/PoliciesSDE/MapServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
temp = input.value
HOPolicies.setDefinitionExpression("POLICY_NO = '" + temp +"'");
map.addLayers([HOPolicies]);
... View more
10-12-2012
11:38 AM
|
0
|
4
|
1413
|
|
POST
|
Is anyone else trying to use a geocode service in 10.1? Are you having any issues? I currently have 3 issues. 1) Batch Geocoding wioth a composite locator only uses one of the locators unless using a single line input. 2) When batch goecoding over 2000 records your ID numbers must start at 1. If you start at 0 the resulting IDs do not match. Less than 2000 you can use 0 or 1 and it doesn't matter 3) Reversegeocoding does not work. Using the same input as the Reverse Geocode API sample I get a message that the query inputs are incorrect. It looks like the API reference for reverse geocoding did not change from 10.0 to 10.1. Did the parameter input format change? I'd be curious to see if anyone else is having similar issues.
... View more
09-18-2012
07:02 AM
|
0
|
0
|
783
|
|
POST
|
Here is how I added my own custom symbols by addding them to the resource dictionary. The last entry called "CustomStrobeMarkerSymbol" uses visual states to add a label when hovering and simulate the same orange glow used in the viewer when selecting. The XAML.CS code shows how to create the layer passing the renderer name. Hope this helps. XAML
<UserControl.Resources>
<ResourceDictionary>
<esri:SimpleMarkerSymbol x:Key="BlueMarkerSymbol" Color="Blue" Size="12" Style="Circle" />
<esri:SimpleLineSymbol x:Key="RedLineSymbol" Color="Red" Width="4" Style="Solid" />
<esri:SimpleLineSymbol x:Key="BlueLineSymbol" Color="Blue" Width="4" Style="Solid" />
<esri:SimpleFillSymbol x:Key="RedFillSymbol" Fill="#66FF0000" BorderBrush="Red" BorderThickness="2" />
<esri:SimpleFillSymbol x:Key="BlueFillSymbol" Fill="#660000FF" BorderBrush="Blue" BorderThickness="2" />
<esri:SimpleFillSymbol x:Key="WhiteFillSymbol" Fill="#AAFFFFFF" BorderBrush="#DD000000" BorderThickness="2" />
<esri:PictureMarkerSymbol x:Key="RedStickpin" OffsetX="16" OffsetY="32" Source="/PolicyQuerySpatial.AddIns;component/Images/RedStickpin.png" Height="32" Width="32" />
<esri:PictureMarkerSymbol x:Key="BlueStickpin" OffsetX="16" OffsetY="32" Source="/PolicyQuerySpatial.AddIns;component/Images/BlueStickpin.png" Height="32" Width="32" />
<esri:MarkerSymbol x:Name="CustomStrobeMarkerSymbol">
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Canvas>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Selected">
<Storyboard RepeatBehavior="1x"><!--"ForEver"-->
<DoubleAnimation BeginTime="0" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" From="1" To="6" Duration="00:00:00.5" />
<DoubleAnimation BeginTime="0" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" From="1" To="6" Duration="00:00:00.5" />
<DoubleAnimation BeginTime="0" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)" From="1" To="1" Duration="00:00:01" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unselected" />
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="labelOnHover"
Storyboard.TargetProperty="Visibility"
Duration="0">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation From="0" To="1" Storyboard.TargetName="labelOnHover"
Storyboard.TargetProperty="Opacity"
Duration="0:0:.25" />
</Storyboard>
</VisualState>
<VisualState x:Name="Normal" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" RenderTransformOrigin="0.5,0.5" x:Name="ellipse" IsHitTestVisible="False">
<Ellipse.RenderTransform>
<ScaleTransform />
</Ellipse.RenderTransform>
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#8DFFFF00" />
<GradientStop Color="#8DFFFF00" Offset=".4" />
<GradientStop Color="#8DFF7600" Offset=".8" />
<GradientStop Color="#00FF7600" Offset="1" />
<!--<GradientStop Color="#00FF0000" Offset="1" />-->
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" Fill="#FFFF0000" x:Name="ellipse1" />
<Grid Margin="8,-8,0,0" x:Name="labelOnHover" Visibility="Collapsed"
HorizontalAlignment="Left" VerticalAlignment="Top" >
<!--Text halo using a white blurred text-->
<TextBlock Foreground="White" FontWeight="Bold" Text="{Binding Attributes[POLICY_NO]}" >
<TextBlock.Effect>
<BlurEffect Radius="5" />
</TextBlock.Effect>
</TextBlock>
<!--Text-->
<TextBlock Foreground="Black" FontWeight="Bold" Text="{Binding Attributes[POLICY_NO]}" />
</Grid>
</Canvas>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
</ResourceDictionary>
</UserControl.Resources>
XAML.CS
// Retrieve or create a graphics layer to use for displaying results
GraphicsLayer graphicsLayer = null;
if (featureSet.Features[0].Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint)// && featureSet.Count() < 6)
graphicsLayer = GetOrCreateLayer("Policy Spatial Query Results", "CustomStrobeMarkerSymbol");
private GraphicsLayer GetOrCreateLayer(string layerId, string renderer)
{
Layer layer = MapApplication.Current.Map.Layers[layerId];
if (layer != null && layer is GraphicsLayer)
{
return layer as GraphicsLayer;
}
else
{
GraphicsLayer gLayer = new GraphicsLayer()
{
ID = layerId,
Renderer = new SimpleRenderer()
{
Symbol = Resources[renderer] as Symbol
}
};
gLayer.SetValue(MapApplication.LayerNameProperty, layerId);
return gLayer;
}
}
... View more
09-18-2012
05:35 AM
|
0
|
0
|
561
|
|
POST
|
JT- I am still working with ESRI to resolve my issue. We have made some progress in the troubleshooting process but have not pinned down a solution to my issue. Our "normal" AD users are created by a provisioning job and that seems to be the root cause of the issue. I was able to verify this by duplicating my account to create a test account which all of the same permissions. This new test account allows me to admin the server while my regular account that was created with our provisioning jobs will not. So to you question, is ArcGIS Server 10.1 with AD/integrated security ready for "prime-time"?, I can't honest say yes or no until I find the cause of my issues. I can say that I do not have any issues with user security at the service level and Administration works fine when using an account that does not use our provisioning process. Once I get this issue resolved I will definately post back here with more details.
... View more
09-13-2012
08:32 AM
|
0
|
0
|
1703
|
|
POST
|
I am getting close but can;t quite get it to populate the datagrid. The code below gets me the correct number of features that should be in the datagrid and even adds the correct number of rows to the table. However, the table rows do not contain any data. So close and I feel like it is something very easy that I am missing. Ideas anyone? XAML <sdk:DataGrid AutoGenerateColumns="True" Height="236" HorizontalAlignment="Left" Margin="12,52,0,0" Name="dg1" VerticalAlignment="Top" Width="476">
<sdk:DataGrid.Columns>
<!--<sdk:DataGridTextColumn Binding="{Binding Path=OID}" SortMemberPath="OID" Header="OID"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=LossDt}" SortMemberPath="LossDt" Header="LossDt"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=FREQUENCY}" SortMemberPath="FREQUENCY" Header="FREQUENCY"/>-->
<sdk:DataGridTextColumn Binding="{Binding MEAN_LossA}" SortMemberPath="MEAN_LossA" Header="MEAN_LossA"/>
<!--<sdk:DataGridTextColumn Binding="{Binding Path=SUM_LossAm}" SortMemberPath="SUM_LossAm" Header="SUM_LossAm"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=MEAN_ExpAm}" SortMemberPath="MEAN_ExpAm" Header="MEAN_ExpAm"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=SUM_ExpAmt}" SortMemberPath="SUM_ExpAmt" Header="SUM_ExpAmt"/>-->
</sdk:DataGrid.Columns>
</sdk:DataGrid> XAML CS
public interface HailData {}
public class HailAttributes : HailData
{
//public double OID;
//public string LossDt;
// public double FREQUENCY;
public string MEAN_LossA;
//public double SUM_LossAm;
//public double MEAN_ExpAm;
//public double SUM_ExpAmt;
}
public string MEAN_LossA
{
get { return MEAN_LossA; }
}
private void GeoprocessorTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.GPExecuteCompleteEventArgs e)
{
try
{
this.dg1.ItemsSource = null;
foreach (GPParameter gpParameter in e.Results.OutParameters)
if (gpParameter.Name == "output_dbf")
{
GPRecordSet gpLayer = gpParameter as GPRecordSet;
List<HailData> theList = new List<HailData>();
foreach (Graphic feature in gpLayer.FeatureSet.Features)
{
//MessageBox.Show(feature.Attributes["MEAN_LossA"].ToString());
theList.Add(new HailAttributes()
{
//OID = Convert.ToDouble(feature.Attributes["OID"]),
//LossDt = feature.Attributes["LossDt"].ToString(),
//FREQUENCY = Convert.ToDouble(feature.Attributes["FREQUENCY"]),
MEAN_LossA = feature.Attributes["MEAN_LossA"].ToString(),
//SUM_LossAm = Convert.ToDouble(feature.Attributes["SUM_LossAm"]),
//MEAN_ExpAm = Convert.ToDouble(feature.Attributes["MEAN_ExpAm"]),
//SUM_ExpAmt = Convert.ToDouble(feature.Attributes["SUM_ExpAmt"]),
});
}
MessageBox.Show(theList.Count().ToString());
this.dg1.ItemsSource = theList;
}
btnPoint.IsEnabled = true;
}
catch (OverflowException oEx)
{
MessageBox.Show(oEx.Message);
btnPoint.IsEnabled = true;
}
catch (FormatException fEx)
{
MessageBox.Show(fEx.Message);
btnPoint.IsEnabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " stacktrace:" + ex.StackTrace);
btnPoint.IsEnabled = true;
}
}
... View more
08-15-2012
11:56 AM
|
0
|
0
|
1983
|
|
POST
|
So I am getting my reults back as I can get a correct feature count on the GPParameter. I still can't get my results to show in a datagrid. The code below give me a datagrid with the correct # of items but the data is showing information about the data and not the data itself. Any help is appreciated. foreach (GPParameter gpParameter in e.Results.OutParameters)
if (gpParameter.Name == "output_dbf")
{
GPRecordSet gpLayer = gpParameter as GPRecordSet;
MessageBox.Show(gpLayer.FeatureSet.Count().ToString());
dg1.ItemsSource = gpLayer.FeatureSet.Features;
}
[ATTACH=CONFIG]16934[/ATTACH]
... View more
08-14-2012
09:50 AM
|
0
|
0
|
1983
|
|
POST
|
I am attempting to batch geocode using the new Find Addresses functionality in 10.1. I have a composite locator based on StreetMap Premium locators published as a service. The locator has 4 levels of matching which are StreetAddress, StreetName, Zip Code, & CityState. When using Find Addresses and only supplying a zip code, it will not use the zip code locator. If I provide a complete address it will find it with any of the other 3 locators. The strange thing is when I use Get Candidates to greocode a single address it uses all 4 locators just fine. Any ideas? All locators are in the same directory and I had no issues publishing.
... View more
08-09-2012
11:47 AM
|
0
|
0
|
1046
|
|
POST
|
Do you have an "Out Fields" input? If so put a asterik(*) to get all fields. This works with my streetmap premium geocoding service.
... View more
08-09-2012
09:04 AM
|
0
|
0
|
859
|
|
POST
|
So I think what you are saying is that you published a service using a file geodatabase and when adding the service you do not see any feature. Do you see any features in the builder prior to publishing the map? If you view the service at the rest endpoint usinf the ArcGIS Javascript link, do you see your features? Do you have any scale dependancies set? This may be dumb but in silverlight expand your layer service and make sure your layers are turned on. Also, you are not able to see a table of attributes when you bring in the whole service. Instead try browsing to you service and the service you want and tray adding just 1 layer of that service. Then you will be able to view attributes of that layer. I hope this steers you in the right direction..
... View more
08-08-2012
05:34 AM
|
0
|
0
|
671
|
|
POST
|
Thanks for the reply Bruce. I am going to discuss that idea with my DBAs. In the meantime I was able to create a GP service that copies data from one table A to Table B. Table B has a geocoding relationship with a feature class and since the server is performing the geodatabase function, the geocoding works. Additional testing is needed but my initial experience is positive.
... View more
08-03-2012
08:06 AM
|
0
|
0
|
2145
|
|
POST
|
This thread is a bit old but I am wondering if anyone was able to geocode dynamically when updating a table in in SQL. It seems dynamic geocoding only works when updating through arcgis. Updating the same table using ArcPY allows the dynamic geocoding to work. Is there a way to have SQL run a python script? Thanks..
... View more
08-02-2012
10:27 AM
|
1
|
0
|
2145
|
| 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 |
yesterday
|