POST
|
The error hints at a server, are you storing data in ArcServer? If so it might be some weird permissions problem, if it is then I have to defer to someone else with more knowledge of ArcServer (as I have not used it). So that in mind can you try putting your newFc in a file geodatabase and try writing to that? Yeah, I don't know why it's talking about a server. I'm doing nothing with ArcSever. Everything is on my C drive right now and this is just a stand-alone desktop application.
... View more
10-07-2013
11:29 AM
|
0
|
0
|
773
|
POST
|
Without seeing the actual error message and as the code looks OK to me I'm guessing the problem is to do with your newFC. Are you trying to: Insert incorrect geometries (e.g. storing a polyline in a point FeatureClass)? Does the source featureclass have a different spatial reference? Does the source featureclass support MZ values and your newFC does not? Also can you confirm your queryfilter is actually selecting data? Thanks for the reply. The error message is really vague: Error: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) Exception: System.Runtime.InteropServices.COMException. I was thinking the error might be with the newFC as well. I created a copy of the source DB, deleted the features from it, and tried to write to that and I got the same error. So, it has to be something going awry with the insert and/or values going into fields. Though, like I said, I went through and checked every value going into the first feature buffer and they all match the field types. I can confirm the queryfilter is returning data. I took out a line of code that skips feature classes when the queryfilter returns nothing: if (currFeat == null) continue;
... View more
10-07-2013
11:08 AM
|
0
|
0
|
773
|
POST
|
I have a QC process that runs through some data, flags various features, and then I want it to write them out to a new database with an exact copy of the feature class (I can't copy the feature class completely, because not all of the features are flagged). My code for flagging the data works fine, but when I go to insert my created feature buffer I get a vague COM Exception. I've read that these errors usually occur with field/field value errors, but I've used a IFieldChecker, which reports no errors. And I've gone through the created feature class fie and the values in the feature using (ComReleaser comReleaser = new ComReleaser()) { IFeatureCursor featuresToCopy = fc.Search(qf, true); comReleaser.ManageLifetime(featuresToCopy); IFeature currFeat = featuresToCopy.NextFeature(); IFeatureCursor insertCursor = newFC.Insert(true); comReleaser.ManageLifetime(insertCursor); while (currFeat != null) { IFeatureBuffer featBuff = newFC.CreateFeatureBuffer(); // Add the original feature's geometry to the feature buffer. featBuff.Shape = currFeat.Shape; // Add all the original feature's fields to the feature buffer AddFieldsToFeatureBuffer(ref featBuff, currFeat); try { insertCursor.InsertFeature(featBuff); } catch { throw; } currFeat = featuresToCopy.NextFeature(); } } //This code was taken right from here private void AddFieldsToFeatureBuffer(ref IFeatureBuffer featBuffer, IFeature feature) { // Copy the attributes of the orig feature the new feature IRowBuffer rowBuffer = (IRowBuffer)featBuffer; IFields fieldsNew = rowBuffer.Fields; IFields fields = feature.Fields; for (int i = 0; i <= fields.FieldCount - 1; i++) { IField field = fields.get_Field(i); if ((field.Type != esriFieldType.esriFieldTypeGeometry) && (field.Type != esriFieldType.esriFieldTypeOID)) { int intFieldIndex = fieldsNew.FindField(field.Name); if (intFieldIndex != -1) { try { var value = feature.get_Value(i); featBuffer.set_Value(intFieldIndex, value); } catch (Exception ex) { WriteError(ex); } } } } } Also, I'm not sure if it is related, but when I am debugging the code the execute function to check the members of the insert cursor does not work. I am assuming it's because the cursor has an exclusive lock on the data.
... View more
10-07-2013
08:26 AM
|
0
|
8
|
2676
|
POST
|
Yeah you can't essentially edit a table in two different processes at the same time. It requires an exclusive lock to do that. Also, I've found that instead of setting the feature cursor to null, something like this is much better:
using (ComReleaser cr = new ComReleaser())
{
IFeatureCursor updateCursor = featureClass.Update(queryFilter, false);
cr.ManageLifetime(updateCursor);
// Do stuff
}
GC.Collect();
... View more
10-02-2013
03:02 AM
|
1
|
0
|
331
|
POST
|
If you are using text and not an image, why don't you change the display to show "Text Only"? Go into "Customize" and right click the button. And select "Text Only" instead of Default Style. Then it will show the "Name" of the add-in which you can adjust right there. There is probably a way to set that as the default when the tool is added, but I do not know how to do that.
... View more
10-01-2013
07:45 AM
|
0
|
0
|
315
|
POST
|
So, I went ahead and contacted ESRI support and figured out how to solve this problem. The parameter is set like this: stats.statistics_fields = "J_Fld COUNT"; stats.case_field = "J_Fld";
... View more
09-24-2013
11:27 AM
|
0
|
0
|
221
|
POST
|
Do you need something specific? There is pretty good explanation of how to run a Geoprocessor tool here: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Using_geoprocessing/0001000004mm000000/ And the Raster Calculator: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Members/004700002782000000/
... View more
09-20-2013
02:52 AM
|
0
|
0
|
910
|
POST
|
The ArcGIS Server is not involved in this process, it just exists in our environment and is accessed by another application. Yes, it is IFeatureWorkspace and it references the SDE. The OpenFeatureClass call isn't that slow but we're calling it for each of our tens of layers, and it accumulates to few tens of seconds. So does a remote OpenFeatureClass should be instant as well? I run several processes that run through 50-60 feature classes and one of the fastest parts is opening the FCs. I could probably loop through and open all of them in under 5 seconds. I ran a process just earlier today that did that and deleted a field from each in 19 seconds. Are you using a profiler to clock your code? If not, how are you finding that's the slowest part? I would think the intersections is what is eating up processing. Maybe try opening more than one thread?
... View more
09-19-2013
12:10 PM
|
0
|
0
|
209
|
POST
|
For the Statistics geoprocessor tool one of the parameters is the "statistics_fields". It calls for the fields you want to get statistics on as well as the type of statistic. In pyton, it looks like this (see 3rd param): arcpy.Statistics_analysis("futrds", "C:/output/output.gdb/stats", [["Shape_Length", "SUM"]], "NM") My question is, how do I set up this parameter in .NET? Geoprocessor GP = new Geoprocessor(); Statistics stats = new Statistics(); stats.in_table = @"C:\Temp\Test\myRight.shp"; stats.out_table = @"C:\Temp\test.dbf"; stats.statistics_fields = "[['J_Fld','COUNT']]"; GP.Execute(stats, null); I've tried sending it strings formatted in several different ways, an array like the one in python, and a IVariantArray with no luck. Thanks.
... View more
09-18-2013
09:24 AM
|
0
|
2
|
533
|
POST
|
So, I figured it out after A LOT of trial and error. // I found out that you cannot check "IS NULL" in a joined FC where the FCs are in a DB. // So, the CreateShapefileFromFeatClass creates a temporary shapefile IFeatureClass left = GetFCByName("Left_FC"); IFeatureClass right = GetFCByName("Right_FC"); IFeatureClass leftSAFC = CreateShapefileFromFeatClass(left, "myLeft"); IFeatureClass rightSAFC = CreateShapefileFromFeatClass(right, "myRight"); IFeatureLayer left_FL = new FeatureLayer() { FeatureClass = leftSAFC }; IFeatureLayer right_FL = new FeatureLayer() { FeatureClass = rightSAFC }; IMemoryRelationshipClassFactory memRelClassFact = new MemoryRelationshipClassFactory(); IRelationshipClass relClass = memRelClassFact.Open("Join", left_FL.FeatureClass, "J_Fld", right_FL.FeatureClass, "J_Fld", "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne); // You can only wrap a feature layer in a DisplayRelationshipClass IDisplayRelationshipClass dispRelClass = (IDisplayRelationshipClass)left_FL; dispRelClass.DisplayRelationshipClass(relClass, esriJoinType.esriLeftOuterJoin); ITable tbl = (ITable)dispRelClass; // This where clause find where the right join field is null, AKA no match string whereClause = "myRight.J_Fld IS NULL";
... View more
09-17-2013
08:28 AM
|
0
|
0
|
291
|
POST
|
Say I have the two attached tables that I want to join together in code using the "J_Fld". As you can see, it is a one-to-many join and there will be one row in the left table that does not have a match in the right table. I want to get a result that returns "all-results" like the join options in ArcMap (so include the one without a relationship). If I used a QueryDefinition I get everything but the one without a relationship. The API has code for a IRelationshipClass: // Build a memory relationship class. Type memRelClassFactoryType = Type.GetTypeFromProgID( "esriGeodatabase.MemoryRelationshipClassFactory"); IMemoryRelationshipClassFactory memRelClassFactory = (IMemoryRelationshipClassFactory)Activator.CreateInstance(memRelClassFactoryType) ; IRelationshipClass relationshipClass = memRelClassFactory.Open("ParcelsOwners", parcelsFeatureClass, "PARCEL_ID", (IObjectClass)ownersTable, "PARCEL_ID", "Is Owned By", "Owns", esriRelCardinality.esriRelCardinalityOneToOne); // Open the RelQueryTable as a feature class. Type rqtFactoryType = Type.GetTypeFromProgID("esriGeodatabase.RelQueryTableFactory"); IRelQueryTableFactory rqtFactory = (IRelQueryTableFactory)Activator.CreateInstance (rqtFactoryType); ITable relQueryTable = (ITable)rqtFactory.Open(relationshipClass, false, null, null, String.Empty, false, false); If I change the cardinality to "esriRelCardinalityManyToMany" the return table only has 4 rows in it. It looks like no matter what it returns a one-to-one and takes a "first case wins" approach. I was thinking the way to go about it is IRelationshipClass.GetRelationshipForObject, but it doesn't seem to like being passed a table row as an object. Any ideas?
... View more
09-12-2013
07:52 AM
|
0
|
2
|
2860
|
POST
|
If you create your polygon first by unioning all the polygons from your buffer feature class, then use the polygon as the geometry in the spatial query, you should get all the features from the seperate feature class that intersect the one big polygon. You then can delete all these features one by one by going through the cursor. This worked. I kind of feel dumb what I was trying to do now. Thank you.
... View more
08-29-2013
07:09 AM
|
0
|
0
|
237
|
POST
|
I am looking for a non-geoprocessor solution. So, I have searched the forums and Google and have not found what I am looking for. I have a single polygon (which is a dissolved buffer from a different feature class) and a separate feature class that I want to find the intersections between and then delete those features. It appears to me that a SpatialQuery only operates on one feature class. I am guessing this could be done with a GeometryBag, but then I believe it would also find the intersections within the feature class, which I do not want to delete. Any help would be appreciated.
... View more
08-28-2013
07:04 AM
|
0
|
3
|
642
|
POST
|
I'm guessing that joinTable is the result of a table join? If so, I'm pretty sure you can't edit that. At least that's how it used to be -you could only edit the original featureclasses/tables. That's a real pain in the butt if it's true.
... View more
08-02-2013
10:52 AM
|
0
|
0
|
149
|
POST
|
I have some code that I am updating. Originally, I was just reading the data with the 'get_Value' method, but I am now trying to change the data with 'set_Value'. However, when I call the 'set_Value' method I get a "NotImplementedException" which makes absolutely no sense to me.
ICursor cur = joinTable.Search(qf, false);
using (ComReleaser comReleaser = new ComReleaser())
{
comReleaser.ManageLifetime(cur);
IRow row = null;
while ((row = cur.NextRow()) != null)
{
//do some stuff
row.set_Value(row.Fields.FindField(myFieldName), myValue);
cur.UpdateRow(row);
}
}
So that throws the exception. It's pretty similar to the code under "Using an update cursor" here. Also, I change the cursor to "ICursor cur = joinTable.Update(qf, false);" I get the exception at that line. Any ideas or words on the problem would be appreciated.
... View more
08-02-2013
09:18 AM
|
0
|
2
|
578
|
Title | Kudos | Posted |
---|---|---|
1 | 10-02-2013 03:02 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|