|
POST
|
The project needed to be recompiled for 10.2, which I'd thought wouldn't be necessary, since I saw no such requisite for 10.2 in the ArcObjects documentation. Oh, well, it seems these version changes always break something.
... View more
11-26-2013
07:30 AM
|
0
|
0
|
506
|
|
POST
|
I have a custom layer which, when published to a PMF, will open fine in ArcMap 10.2 but does not appear in ArcReader 10.2. I do not see this problem with 10.1. Is there a known issue at 10.2?
... View more
11-26-2013
06:50 AM
|
0
|
1
|
2282
|
|
POST
|
I guess my wording was poor. I'm adding features to a feature class that already participates in a geometric network, not making modifications to the network definition itself. As I said, I can do it just fine using ArcObjects instead of arcpy.da, or arcpy.da works fine if the feature class does not participate in the network.
... View more
04-24-2013
06:32 PM
|
0
|
0
|
1284
|
|
POST
|
When I attempt to use arcpy.da to add junction features to a geometric network, I get the error "error return without exception set." Here's the code in question:
def Migrate_GasLamp_DA():
sSourceClass = sSourceGDB + "/gaslight"
sTargetClass = "GasLamp"
SourceFieldList = ["SHAPE@", "PLACEMENT_CODE"]
TargetFieldList = ["SHAPE@", "ENABLED", "CREATIONUSER", \
"DATECREATED", "DATEMODIFIED", "LASTUSER"]
dtCreate = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
edit = da.Editor(sTargetGDB)
edit.startEditing(False, False)
edit.startOperation()
c = da.InsertCursor(sTargetClass, TargetFieldList)
iTotal = 0
i = 0
with da.SearchCursor(sSourceClass, SourceFieldList) as cursor:
for row in cursor:
iTotal += 1
i += 1
if i == 1000:
edit.stopOperation()
edit.startOperation()
i = 0
geom = row[0]
sPC = row[1]
tok = UserDateFromPC(sPC)
sUser = tok[0]
dtPC = tok[1]
newrow = [geom, 1, "Data Migration", dtCreate, \
dtPC, sUser]
c.insertRow(newrow)
del c
edit.stopOperation()
edit.stopEditing(True)
return iTotal
The above code works fine if the target feature class does not participate in a geometric network. When I use ArcObjects instead of arcpy.da, I have no troubles:
def Migrate_GasLamp_AO():
GetESRIModule("esriGeoDatabase.olb")
GetESRIModule("esriDataSourcesGDB.olb")
import comtypes.gen.esriGeoDatabase as esriGeoDatabase
import comtypes.gen.esriDataSourcesGDB as esriDataSourcesGDB
pWSF = NewObj(esriDataSourcesGDB.FileGDBWorkspaceFactory, \
esriGeoDatabase.IWorkspaceFactory)
pSourceWS = pWSF.OpenFromFile(sSourceGDB, 0)
pSourceFWS = CType(pSourceWS, esriGeoDatabase.IFeatureWorkspace)
pTargetWS = pWSF.OpenFromFile(sTargetGDB, 0)
pTargetFWS = CType(pTargetWS, esriGeoDatabase.IFeatureWorkspace)
pSourceFC = pSourceFWS.OpenFeatureClass("gaslight")
pTargetFC = pTargetFWS.OpenFeatureClass("GasLamp")
iPC = pSourceFC.FindField("PLACEMENT_CODE")
iEn = pTargetFC.FindField("ENABLED")
iCU = pTargetFC.FindField("CREATIONUSER")
iDC = pTargetFC.FindField("DATECREATED")
iDM = pTargetFC.FindField("DATEMODIFIED")
iLU = pTargetFC.FindField("LASTUSER")
dtCreate = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
pFCursor = pSourceFC.Search(None, True)
iTotal = 0
i = 0
pEditWS = CType(pTargetWS, esriGeoDatabase.IWorkspaceEdit)
pEditWS.StartEditing(False)
pEditWS.StartEditOperation()
while True:
pSourceFeat = pFCursor.NextFeature()
if not pSourceFeat:
break
iTotal += 1
i += 1
if i == 1000:
pEditWS.StopEditOperation()
pEditWS.StartEditOperation()
i = 0
sPC = pSourceFeat.Value(iPC)
tok = UserDateFromPC(sPC)
sUser = tok[0]
dtPC = tok[1]
pTargetFeat = pTargetFC.CreateFeature()
pTargetFeat.Shape = pSourceFeat.Shape
pTargetFeat.Value[iEn] = 1
pTargetFeat.Value[iCU] = "Data Migration"
pTargetFeat.Value[iDC] = dtCreate
pTargetFeat.Value[iDM] = dtPC
pTargetFeat.Value[iLU] = sUser
pTargetFeat.Store()
pEditWS.StopEditOperation()
pEditWS.StopEditing(True)
return iTotal
Is there a limitation to arcpy.da that I can't find in the documentation?
... View more
04-24-2013
12:42 PM
|
0
|
5
|
3035
|
|
IDEA
|
-->
I'd like to see more SQL functionality in the file geodatabase API, including more SQL functions (e.g. DISTINCT), joins, aliases, etc.
... View more
04-08-2013
10:37 AM
|
9
|
0
|
372
|
|
POST
|
Well, DUH, it would help if I didn't convert the value I was looking for to upper case! I didn't even notice that yesterday. 😛 One thing I DID notice, however: whether I use ExecuteSQL or Table.Search, output is not confined to specified subfields. A row is fully populated in any case.
... View more
01-23-2013
04:53 AM
|
0
|
0
|
943
|
|
POST
|
I'm having trouble querying string coded values via ExecuteSQL in the API. I can query numeric codes just fine, for example: SELECT * FROM street_anno WHERE horizontalalignment = 1 Most of my coded value domains are strings where the code and the name are the same. If I query against a particular code, no rows are returned: SELECT * FROM station WHERE feature_status = 'As-Built'; I only get rows returned if I query against the first character of the code: SELECT * FROM station WHERE feature_status LIKE 'A%'; Any ideas? Perhaps it's a unicode issue? I'm using 1.3 BTW.
... View more
01-22-2013
01:18 PM
|
0
|
2
|
2516
|
|
POST
|
I might add that "upgrading" a file geodatabase from 9 to 10 causes problems with the API. The only free-and-clear migration path is to create a new 10.x file gdb and copy the datasets to it.
... View more
01-22-2013
01:08 PM
|
0
|
0
|
874
|
|
POST
|
As of 3.0, you can use GenerateRendererTask to get a list of unique field values.
List<string> FieldList = new List<string>() { sFieldName };
ColorRamp colorRamp = new ColorRamp();
colorRamp.Algorithm = Algorithm.CIELabAlgorithm;
colorRamp.From = Colors.Black;
colorRamp.To = Colors.White;
ObservableCollection<ColorRamp> ColorRamps = new ObservableCollection<ColorRamp>() { colorRamp };
UniqueValueDefinition uvDef = new UniqueValueDefinition();
uvDef.Fields = FieldList;
uvDef.ColorRamps = ColorRamps;
GenerateRendererParameters grParam = new GenerateRendererParameters();
grParam.ClassificationDefinition = uvDef;
if (sWhereClause != null)
grParam.Where = sWhereClause;
GenerateRendererTask grt = new GenerateRendererTask(sUrl);
grt.ExecuteCompleted += new EventHandler<GenerateRendererResultEventArgs>(grt_ExecuteCompleted);
grt.Failed += new EventHandler<TaskFailedEventArgs>(grt_Failed);
grt.ExecuteAsync(grParam, userToken);
[snip]
GenerateRendererResult grResult = e.GenerateRendererResult;
UniqueValueRenderer uvRenderer = (UniqueValueRenderer)grResult.Renderer;
List<string> UniqueValues = new List<string>();
foreach (UniqueValueInfo uvInfo in uvRenderer.Infos)
{
if (uvInfo.Value == null)
continue;
UniqueValues.Add(uvInfo.Value.ToString());
}
... View more
01-14-2013
12:55 PM
|
0
|
0
|
1012
|
|
POST
|
I would not normally start an edit session programmatically while listening for an onCreateFeature event, but this problem was brought to my attention and I was able to duplicate it. If I have a Python add-in consisting of an extension which listens for the onCreateFeature event, and a button which calls the Editor (through comtypes) to start an edit session, an Access Violation error will result when the button attempts to start the edit session. If the extension is deactivated, the error doesn't occur. If I start the edit session from a separate Python instance while the extension is active, the error doesn't occur either. This leads me to believe that whatever mechanism is used to listen for Editor events is causing some sort of contention in the Python engine when simultaneously manipulating the Editor object. What do you think?
... View more
12-28-2012
04:34 AM
|
0
|
0
|
2595
|
|
POST
|
I wanted to create a marker symbol that centers a label beneath the point. I eventually came up with the following, which works, but I'd like to know if there's a better approach that I'm not seeing, especially one that's pure XAML. Thanks!
<Window.Resources>
<src:CanvasLeftMidpointOffsetter x:Key="LeftOffsetter" />
<esri:MarkerSymbol x:Key="CenterLabelSymbol">
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Canvas>
<Ellipse Canvas.Top="-6" Canvas.Left="-6" Width="12" Height="12" Fill="Black"
HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBlock Canvas.Top="14"
HorizontalAlignment="Center" VerticalAlignment="Top" TextAlignment="Center"
Text="{Binding Attributes[VALUE]}" FontFamily="Arial" FontSize="12">
<Canvas.Left>
<Binding Converter="{StaticResource LeftOffsetter}"
RelativeSource="{x:Static RelativeSource.Self}" Path="ActualWidth" />
</Canvas.Left>
</TextBlock>
</Canvas>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
</Window.Resources>
public class CanvasLeftMidpointOffsetter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// Convert (double) ActualWidth to (double) Canvas.Left
double dActualWidth = (double)value;
return -dActualWidth / 2;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// Meaningless
return 0;
}
}
... View more
11-13-2012
08:46 AM
|
0
|
0
|
910
|
|
POST
|
Thanks for the suggestion; unfortunately, it didn't work. I think there may be some sort of locking issue involved.
... View more
09-26-2012
06:22 AM
|
0
|
0
|
572
|
|
POST
|
I have a local dynamic layer referenced to a file geodatabase. One of the point feature classes is also accessed by a local feature service. When I update the feature class through the feature service, it completely stops rendering in the dynamic layer. But then, if I open the feature class in ArcMap while the WPF app is still running, it immediately starts rendering again! Has anyone else encountered this, and found a solution? UPDATE: When I use the feature service to drive a separate dynamic layer, that layer refreshes properly when features are updated. It's not the sort of workaround I'm looking for, but it's a start.
... View more
09-25-2012
12:45 PM
|
0
|
2
|
820
|
|
POST
|
A raster catalog works fine, so I guess that's the workaround.
... View more
09-12-2012
07:08 AM
|
0
|
0
|
482
|
|
POST
|
I created a local, referenced map package that includes a mosaic dataset layer. It displays at all scales when I open the package in ArcMap, but in Runtime it stops rendering when I zoom in past about 1:60,000: this makes it pretty useless for my application. I created another map package showing just the mosaic dataset and it behaves the same way. I also see the same behavior when I add the dataset as a dynamic layer. Any idea why this is happening?
... View more
09-07-2012
02:31 PM
|
0
|
1
|
3050
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-04-2012 06:42 AM | |
| 1 | 09-23-2021 10:42 AM | |
| 2 | 09-28-2021 07:07 AM | |
| 1 | 04-07-2021 10:31 PM | |
| 3 | 03-21-2021 01:14 PM |
| Online Status |
Offline
|
| Date Last Visited |
01-07-2022
08:31 AM
|