POST
|
You have to check out a license if you are using ArcObjects components in a non-esri application (like office). Do you already get a license via the IAoInitialize interface?
... View more
08-22-2010
11:41 PM
|
0
|
0
|
233
|
POST
|
If you use the code as you have posted it, you might want to escape the folder seperator "\". You did after the drive letter, but not for the subfolders.
... View more
08-17-2010
11:16 PM
|
0
|
0
|
908
|
POST
|
A straigth forward solution might be to do the query in two steps. First use a spatial filter with the EnvelopesIntersect filter type, that gives you a cursor to all the polygons which could have their centroid inside the query Polygon. Then in step two you take every Polygon you get as a result from step one and run a second spatial filter to check if the current polygons centroid lies within the polygon in question. Maybe not very efficient to use a spatial filter for each polygon-polygon pair, probably the IHitTest result bRightSide could be used for step two, if your polygons are not complex (holes...)
... View more
08-17-2010
11:08 PM
|
0
|
1
|
264
|
POST
|
I've just made a test on this issue. This simple function is called in an inifite loop:
private static void check(IFeatureWorkspace fws)
{
IFeatureCursor c = fws.OpenFeatureClass("XYZ").Search(null, false);
IFeature f = c.NextFeature();
m_List = null;
GC.Collect(2);
m_List = new List<IFeature>();
while (f != null)
{
m_List.Add(f);
f = c.NextFeature();
}
Marshal.FinalReleaseComObject(c);
}
Each time the function is called the memory usage drops to approximately the size it had before the last cursor loop, maybe a few KB more. Can you post you critical code? Are you sure that there's no other operation involved which might increase memory usage, like in a ClassExtension fireing for each user action?
... View more
08-13-2010
01:23 AM
|
0
|
0
|
601
|
POST
|
You are creating an instance of your Form class without passing any reference to the calling ArcMap application. You declare member variables in the Form class for the MxDocument and Application, but you never set them (m_map, m_app...). If you had declared the member variables of your form private instead of public (as it would be correct in an object oriented design approach) you would have gotten a compiler warning telling you that those variables never get a value assigned. You should try to pass the IApplication object as parameter of your Forms constructor, from that object you can derive all the other references you might need. Set the m_app variable to the Application reference you pass to the constructor, and set all other member variables by using the application's attributes (see documentation for IApplication (ArcMap), IMxDocument etc)
... View more
08-12-2010
12:05 AM
|
0
|
0
|
284
|
POST
|
Have you tried the IHitTest Interface yet? Its only function would return the Vertex of the Polygon closest to a given Point. I don't know if it would be faster than your approach, but i guess if your polygons have a large ammount of vertices, it might be.
... View more
08-10-2010
11:28 PM
|
0
|
0
|
219
|
POST
|
Have you tried something like
IExtension analystExtension = pIApplication.FindExtensionByName("Utility Network Analyst");
?
... View more
08-09-2010
07:18 AM
|
0
|
0
|
315
|
POST
|
You could use a IQueryDef object to perform your own join. I'm not familiar with VB, but the general aproach is to call IFeatureWorkspace.CreateQueryDef to get a QueryDef object, where you can set the table names to join in a comma seperated string (like pQueryDef.Tables = "Table1, Table2") define join and filter attributes with the where clause (like pQueryDef.WhereClause = "Table1.key = 'KeyOfCurrentRow' and Table1.key = Table2.key") and maybe set the IQueryDef.Subfields to only get the values you need. After doing so, a call to pQueryDef.Evaluate returns an ICursor with the resulting values of both tables. In other words: You define the parameters for a simple SQL Select-statement and get the result.
... View more
08-09-2010
02:00 AM
|
0
|
0
|
499
|
POST
|
Have you tried to display all loaded extensions with a for-loop and IExtensionManager.Extension[index]? If it's not there either, it's probably not loaded...
... View more
08-09-2010
01:11 AM
|
0
|
0
|
315
|
POST
|
In your main loop try this:
m_map.ClearSelection();
while (Feat != null)
{
spatialFilter.GeometryField = featureClass1.ShapeFieldName;
spatialFilter.Geometry = Feat.Shape;
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
featureCursor1 = featureClass1.Search(spatialFilter, false);
Feat1 = featureCursor1.NextFeature();
while (Feat1 != null) //to check the result of the ispatialquery
{
// MessageBox.Show("FEAT " + Feat1.OID.ToString());
m_map.SelectFeature(l2, Feat1);
Feat1 = featureCursor1.NextFeature();
}
Marshal.FinalReleaseComObject(featureCursor1);
Feat = featureCursor.NextFeature();
}
Marshal.FinalReleaseComObject(featureCursor);
activeView.Refresh();
And try finding better (more descriptive, consistent) variable names, that helps preventing errors. And you have to manually destroy your Cursor objects after using them (see additions above) or otherwise the cursors will remain opened, keeping a lock to their tables ans causing a DB error once you have gone through too many loops and have exceeded the allowed number of open cursors of the DBMS.
... View more
08-09-2010
12:53 AM
|
0
|
0
|
148
|
POST
|
You can trick the QueryFilter instead of using this clumsy tablesort mechanism. (OK, that's not really elegant either, but still better imho): pQueryFilter.Subfields = "stand"; pQueryFilter.WhereClause = "[your selection criteria]) order by (stand"; The trick is the closing and opening bracket. the first (closing) bracket is the counterpart to an opening bracket created by the ArcObjects parser, which builds a multiversioned SQL query for your where-clause. It builds a huge expression from its managed tables and finally adds a "Where ([yourstring])" at the end. So when you directly use an order by statement, it is pushed into the generated where statement causing an error of course. But if you add the closing bracket after your where clause is complete and afterwards start an order by (or group by or whatever), the generated statement has correct syntax and processes as expected. Just make sure to have an opening bracket in front of the last order by parameter, as a counterpart of the automatically generated closing bracket. The generated SQL qery for the two code lines above would be like Select [a huge ammount of columns] from ([an even bigger ammount of joins of uncounted tables]) v_1234 where ([your selection criteria]) order by (stand) (Your whereclause string red, the automatically added brackets from the ArcObjects parser green) It works in some combinations for some other methods too, like IQueryDef's, and it does not for FeatureWorkspace.OpenFeatureQuery sadly. Just try it 😉
... View more
08-05-2010
07:20 AM
|
0
|
0
|
365
|
POST
|
Try to call gParcels.Search(gSF, False) (not-recycling cursor) instead. The ESRI documentation says that it's forbidden to keep a reference to a row retrieved from a recycling cursor (can't say where I've read this, but I did...). The recycling cursor might even be responsible for the memory leak, since it does not release all its ressources as the non-recycling cursor does.
... View more
06-30-2010
01:17 AM
|
0
|
0
|
631
|
POST
|
After using an exclusive schema lock I don't get the error any longer, but the changes are not persisted either 😞
... View more
06-16-2010
11:03 PM
|
0
|
0
|
531
|
POST
|
I've just tried the IFeatureClassWrite. Seems to be considerably faster indeed thanks for the hint! Although it looks like a good option, I am getting a "The requested operation is invalid on a closed state" Exception when calling StopEditing() or StopEditOperation() after everything is done. Do I have to do something else to prevent this? Seems like some mechanism is locking the table.
... View more
06-16-2010
07:43 AM
|
0
|
0
|
531
|
POST
|
I am already using a FeatureBuffer with an InsertCursor (didn't mention that directly, sorry). I think the problem is, that the Featureclass I am working with has some complex features, which forces the InsertFeature function to fall back on the slower CreateFeature / Store functions (as the documentation tells me). I have tried both methods, and they both need the same time for storing a new feature.
... View more
06-16-2010
05:35 AM
|
0
|
0
|
531
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|