POST
|
I see it now: ESRI.ArcGIS.Geoprocessing.GeoProcessor gpUnManaged = new ESRI.ArcGIS.Geoprocessing.GeoProcessor(); gpUnManaged.Execute(name, params, trackCancel); VS ESRI.ArcGIS.Geoprocessor.Geoprocessor gpManaged = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gpManaged.Execute(tool,trackCancel); Details, details... Thanks a lot!
... View more
09-28-2015
12:13 PM
|
0
|
0
|
553
|
POST
|
Hi, just a few hints, if you indend to use ArcObjects and C#, and have not found out already: There are many detalis to consider, and a lot of documentation to read. Online help is useful. This is approximately how I do it: "Acivate split processing mode in your code via custom tool event" "Click on map" ... IPoint p = mxDoc.CurrentLocation; IEnvelope e = p.Envelope; e.Expand( searchRadius); map.SelectByShape(e,env,justOne); IFeatureSelection fs = (IFeatureSelection)lineFeaturelayer; IEnumIDs en = fs.SelectionSet.IDs; en.Reset(); for(int i=0; i<fs.SelectionSet.Count; i++) { Int32 fid = en.Next(); } ... IFeature f = lineFeaturelayer.FeatureClass.GetFeature(fid); IPolyline plin = (IPolyline)f.Shape plin.SplitAtPoint(p, projecPointOnLine, createPart, out splitDone, out newPartIndex, out newSegmentIndex); feature1.shape = .. feature1.Store(); feature2.shape = .. feature2.Store(); ...
... View more
09-27-2015
01:19 PM
|
2
|
0
|
425
|
POST
|
Hi all, I have been using this simple C# code to copy featureclasses between geodatabases (ArcObjects SDK 10.0): ... using ESRI.ArcGIS.DataManagementTools; using ESRI.ArcGIS.Geoprocessor; ... CopyFeatures cf = new CopyFeatures; cf.in_features = "C:\\geodb1.mdb\\MyFeatureClass"; cf.out_feature_class = "C:\\geodb2.gdb\\MyFeatureClass"; Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; gp.AddOutputsToMap = false; gp.Execute(cf,null); ... After installing ArcObjects 10.3, "Geoprocessor.Execute()" is using other parameters, but somehow I cannot find any code examples or documentation dealing with this situation. Any suggestions ? -Ola
... View more
09-27-2015
12:41 PM
|
0
|
2
|
3797
|
POST
|
Of course, you are right ! I was confused by the different SDK's available. Downloaded ArcObjects SDK instead, and everything is back to normal. Thanks a lot! -Ola
... View more
09-21-2015
12:19 PM
|
0
|
0
|
443
|
POST
|
Hi all, I am a bit confused after installing .Net SDK 10.2.6 My existing projects(from SDK10.0) needs new references, because the assemblies they are linked to, are not present in the new SDK. (Or am I missing something?) I can use ESRI COM-objects as references, but they dont always match the old assembly structure. Result is: I cannot find the COM-object to add to the references list in order to use f.ex this class: ESRI.ArcGIS.DataManagementTools.CopyFeatures (Same problem in VS2010 and VS2013, Net runtime 3.5 and 4) Generally, I miss a place to seach for library references, given a class name. Suggestions? TIA Ola
... View more
09-21-2015
03:52 AM
|
0
|
2
|
3144
|
POST
|
You should release the feature objects you're using inside the loop in each loop iteration. The ones I see are fSource, fTargetNew and f (at least it looks like f is a feature object). Call ReleaseComObject on these feature objects inside the loop just as soon as you're done with them just like you do for cursor objects. I have done that, but unfortunately the problem is still there. I have a feeling that there is a fundamental error here that I have overlooked...
... View more
06-07-2012
04:46 AM
|
0
|
0
|
692
|
POST
|
Can you provide details on how many features get added or updated before you get this error? Also are you using recycling cursor or non-recycling cursor? Try releasing cursor after 40,000 or 50,000 iterations and see if that makes any difference. Cheers!! Sumit Thanks for answering. I have tried that in other situations, and it helped. But not here. Only a few hundred features are inserted before the crash. I will reexamine cursor usage. See also example code in above answer.
... View more
06-05-2012
11:30 PM
|
0
|
0
|
692
|
POST
|
Can you post the code for import features? Also, Did you monitor the memory usage in taskmgr while running insert features? Memory usage seem to be normal, with plenty left. It is unpractical to post the entire routine (many layers), but to give an idea of what is going on, here is the main operations: //
// Initiate:
IFeatureclass fcSource = ..
IFeatureClass fcTarget = ...
IWorspaceEdit wsTarget = ...
List sourceIdList = ...
//
// Start transaction:
wsTarget.StartEditing(false);
wsTarget.StartEditOperation();
//
// Do import:
foreach(int sourceOid in sourceIdList)
{
IFeature fSource = fcSource.GetFeature(sourceOid);
...
int a = fSource.get_value(..);
int b = fSource.get_value(...);
//
// Examine values in target fc if necessary:
if(boundsHaveChanged)
{
String whereRestriction = "(a>"+a.ToString() + ") and (b<"+b.ToString()+")";
IQueryFilter qf = new QueryFilterClass();
qf.WhereClause = whereRestriction;
qf.AddField(fieldName);
IFeatureCursor fcur = fl.FeatureClass.Search(qf, false);
IDataStatistics dstat = new DataStatisticsClass();
dstat.Cursor = (ICursor)fcur;
dstat.Field = fieldName;
IStatisticsResults res = dstat.Statistics;
int maxFound = System.Convert.ToInt32(res.Maximum);
...
Marshal.ReleaseComObject(fcur);
Marshal.ReleaseComObject(dstat);
}
IFeature fTargetNew = fcTarget.CreateFeature();
IPoint p = new PointClass();
...
fTargetNew.Shape = p;
...
fTargetNew.set_value(i, f.get_value(j) );
...
fTargetNew.Store();
}
wsTarget.StopEditOperation();
wsTarget.StopEditing(true);
...
... View more
06-05-2012
11:22 PM
|
0
|
0
|
692
|
POST
|
Hi all, I am developing a toolbar for ArcMap with C#, which can import features from external geodatabases. For each feature to import, receiving featureclass is searched for existing values using objectid and cursors. (Cursors are closed using "Marshal.ReleaseComObject(cur);" after use.) and the feature is inserted if needed. This seems to work well as long as the receiving featureclass holds a small number of features, but when the number grows (ex. 100.000), I get a System.AccessViolationException after e few hundred inserts. It looks as if the exception is thrown during FeatureClass.CreateFeature. But it is difficult to examine in the debugger, since it looks as if there is no specific number of inserts before the crash occurs. Using GDB file geodatabase for storage. ArcMap 10.0 SP3 VisualStudio 2010 SP1 Win7-64 Have a missed some limitations here? Any known bugs? TIA Ola
... View more
06-05-2012
01:25 AM
|
0
|
6
|
4670
|
POST
|
It would look something like this:
Dim pFLayer As IFeatureLayer = pMap.Layer(0)
Dim pDefQ As IFeatureLayerDefinition
pDefQ = pFLayer
pDefQ.DefinitionExpression = "OBJECTID = " & 11420 'I just set this for testing an Integer value
'altered to query a string field
pDefQ.DefinitionExpression = "SomeStringField = '" & someStringValue & "'" That's it, thanks a lot! As often before, the solution is quite simple as long as you can find the right interfaces and examples. Which reminds me that the current help system, connected to the VisualStudio, usually answers everything I am NOT looking for...
... View more
10-11-2011
04:15 AM
|
0
|
0
|
1659
|
POST
|
So you are invoking a DefinitionQuery on a featureLayer? The default behavior seems to be that the selected feature should not show if included in the definition query filter. Perhaps it is something specific with your code that is producing the behavior you are seeing. Post up the code you have so far. I guess a queryfilter in the featurelayer would do the trick, but cannot find out how... The examples I find are related to the ArcIMS API, and I cant find similar methods here... Could you give me a hint where to start?
... View more
10-10-2011
10:52 PM
|
0
|
0
|
1659
|
POST
|
The layer itself is set to visible, but I am trying to hide individual features within, based on some attribute values, and even hide them the from ArcMap's selection tool. Ola, Are you saying that when you toggle the layer's visibility off, you can still see the selected features? If so, then it might be that you need to do a full refresh on the ActiveView:
'This line would refresh the selection
pDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, Nothing, Nothing)
'add this line to fully refresh the view
pDoc.ActiveView.Refresh()
... View more
10-10-2011
07:11 AM
|
0
|
0
|
1659
|
POST
|
Hi all, I am developing a toolbar/extension for ArcMap. I want to make certain features invisible in the map, so I define featurelayer symbology based on values in one field. When setting the value outside the range, the feature is hidden. So far so good. But the user can still select the same feature using ArcMaps select tool. Can this be preventet in some way? Are there other methods for controlling feature visibility? (Note: I do NOT want to delete the content of the geometry column, because it must be possible to "undelete" the feature later.) Any suggestions ? TIA Ola
... View more
10-10-2011
06:43 AM
|
0
|
7
|
8169
|
POST
|
Hi all, I am developing a ArcMap 9.3.1 extension i DotNet. (VS2008) Using a polygon featureclass to clip data from a line featureclass and placing the result in a shapefile, works fine. BUT: If there are several polygons in the clipping featureclass, then every polygon is used in the clipping operation, no matter what parameters I use, or if a polygon is selected in advance. See code below. Have I been missing something? Is this supposed to work? IFeatureClass fcPolygons = ... // One polygon is selected in advance. IFeatureClass fcLines = ... WorkspaceNameClass wsNameObj = new WorkspaceNameClass(); wsNameObj.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory"; wsNameObj.PathName = "C:\\Temp"; // // Create the result dataset name object: IDatasetName outputNameObject = new FeatureClassNameClass(); outputNameObject.Name = "test.shp"; outputNameObject.WorkspaceName = wsNameObj; // // Perform clipping: ITable tblLines = (ITable)fcLines; ITable tblPolygons = (ITable)fcPolygons; double tolerance = 0.0; bool useSelectedLines = false; bool useSelectedPolygons = true; ESRI.ArcGIS.Carto.IBasicGeoprocessor gp = new ESRI.ArcGIS.Carto.BasicGeoprocessor(); IFeatureClass fcOutput = gp.Clip(tblLines, useSelectedLines, tblPolygons, useSelectedPolygons, tolerance, (IFeatureClassName)outputNameObject);
... View more
05-18-2011
11:42 AM
|
0
|
0
|
350
|
POST
|
My guess is that you end up rewriting everything, in order to take advantage of better project management and structures...
... View more
04-13-2011
04:27 AM
|
0
|
0
|
347
|
Title | Kudos | Posted |
---|---|---|
2 | 09-27-2015 01:19 PM |
Online Status |
Offline
|
Date Last Visited |
06-21-2022
03:48 AM
|