|
POST
|
You can't read the rows of an idatasetname. The datasetname contains metadata about the featureclass, such as where it is and what type of featureclass it is, it is not the featureclass itself. The point I am trying to make is if your datalayers are broken, as in the data source has been moved or removed, you will neither be able to access the featureclass nor the rows. You can't read what isn't there. But if you can read where the layer is expecting to have data, you can look to see if the data is indeed missing or not. If it is missing, well then you know that is the problem. You will have to put the data back in the expected location or point the layers to a new location where the data is. Its' like your trying to open a file and read the lines from a directory but the file is not there, you will never be able to read the lines if you don't have the file.
... View more
01-17-2012
07:38 AM
|
0
|
0
|
1019
|
|
POST
|
Sounds to me like the data is no longer where it was originally when this last worked. Whenever I have a layer with a broken data source, the layer's featureclass is null. Is it all the layers? If you skip layers with null featureclasses, can you get valid ones? Idatalayer2.Datasourcename contains an IName. You can cast that to an IDatasetName which has a name property which is the name of the featureclass stored. The workspacename will give you access to the properties of the workspace so you can check which database you are connecting to and under which credentials. Once you get all that, check to see if that exists (ArcCatalog comes in handy here if you have access to it.) Good luck!
... View more
01-17-2012
04:12 AM
|
0
|
0
|
1019
|
|
POST
|
I don't see the code here but my guess is you are keeping a reference to every single table you open. This keeps memory and table space for the user locked up on the oracle server and runs out. An Oracle and SDE expert would give you more detail on that. Are you releasing the references to cursors, rows and tables explicitly when done with them (comreleaser or marshalcomrelease)? That could go a long way to avoiding this sort of situation.
... View more
01-11-2012
04:09 AM
|
0
|
0
|
1370
|
|
POST
|
Sounds like you were using ADO recordset to loop through the table. I suspect you were using the Jet4 (MS Access) driver although that is not the only way to do it. You can use the oracle client driver with ADO.NET to do a similar thing. There are many examples online on how to user ADO.NET and oracle, visual studio has lots of tools to do it. Just beware that if the table or featureclass is versioned, not all the data will be in the base tables, some of it could be scattered in the adds and deletes tables, you would need a versioned view of the table to connect to rather than the table itself. You can also use arcobjects to do it, opening an sde workspace, getting the table, creating a search cursor, looping through the cursor, retrieving the data from the row. The ADO.NET way allows you to bind the datatable directly to the control without having the loop through the recordset or cursor which is kind of nice. I won't give you access to the geometry or do edits on a versioned table (it will let you but it is a bad idea) Cheers
... View more
01-10-2012
12:07 PM
|
0
|
0
|
621
|
|
POST
|
Looks like you are passing an element into the GetElementInContainer function. That would force an implicit cast from IElement to IGraphicscontainer. That cast is not valid. You need to pass the graphicscontainer. I would also suggest you turn on the option explicit and option strict in your project. The option strict prevents implicit casts from being compiled. In this case, the code would not compile. I find that helps me write cleaner code where I have to cast every thing to the right interface before using the variable.
... View more
01-10-2012
09:50 AM
|
0
|
0
|
2638
|
|
POST
|
If writing fine grain arcobjects (com, .net, java) I would user ITopologicalOperator intersect on the narrowed down list of features from the spatial query.
... View more
01-10-2012
04:48 AM
|
0
|
0
|
2231
|
|
POST
|
What field type is the poly_no field? I notice when you retrieve the value, you convert it to a string first then an integer, then you set the value as an integer. How is the explode being called? I am not familiar with an event that specifically listens to explode. If memory serves me right, when you explode (convert multipart to single part), one feature gets modified and as many new features get created as are parts -1. I am not sure if the new features are created according to the split policy of the new feature policy. Most of the time numeric fields have split policies or create policies. A create policy for the field defines the default value. A split policy will determine the value of a field according to the split policy. Split policy could be to duplicate the value, or half a numeric value etc. Without understanding of the context in which this code is called it is difficult to say, but there could be some esri code executed after this piece of code setting the value to something else.
... View more
01-09-2012
07:11 AM
|
0
|
0
|
1800
|
|
POST
|
Some datasets require an edit operation. Have you tried to startoperation on the editor and stopoperation after the edit is done? (you might want to un-comment-out the call to nextfeature too.)
... View more
01-09-2012
06:52 AM
|
0
|
0
|
4361
|
|
POST
|
Keagan, This snippet was pulled from a large project that does many more things that does not demonstrate the function and that requires data to have a specific schema and requires specific elements to be in the layout. I don't write add-ins, I write the old fashion ArcObjects components. In this case, I used the function provided to find elements on the page layout from a command in ArcMap. The process would be the same for finding graphic elements on an ArcMap map, an engine mapcontrol or any other graphic container. The graphic container can be obtained by casting the map or layout to an IGraphics container. The map or layout can be obtained from the IMxDocument. As for moving the element, graphic elements implement the ITransform2d interface which has a move method. Cheers
... View more
01-06-2012
04:35 AM
|
0
|
0
|
2638
|
|
POST
|
This is the code I use for that. Just feed it the graphic container of the layout and the name you want. This code won't search sub elements, if you have group elements and you want one of the element in the group, you will have to open it up loop through the sub elements and check the name. Private Function GetElementInContainer(ByVal container As IGraphicsContainer, ByVal name As String) As IElement
container.Reset()
Dim elem As IElement = container.Next
While elem IsNot Nothing
Dim elemProps As IElementProperties = DirectCast(elem, IElementProperties)
If String.Compare(elemProps.Name, name, True) = 0 Then
Return elem
End If
elem = container.Next
End While
Return Nothing
End Function
... View more
01-05-2012
04:48 AM
|
0
|
0
|
2638
|
|
POST
|
Well what I would do, is in the event handler, I would prompt the user to continue or not to continue. If the user chooses to continue, the event handler does nothing else. If the user chooses not to continue I would raise an exception with the message that the user chose to abort the edit. Unfortunately, that will show a second window saying the user aborted the edit. However, the operation will be aborted gracefully and the undo stack will be unaffected.
... View more
12-15-2011
11:01 AM
|
0
|
0
|
1404
|
|
POST
|
could it be 64bit vs 32bit problem? Seems unlikely, but you might still have windows 7 on 32 bit machines.
... View more
12-15-2011
10:11 AM
|
0
|
0
|
2012
|
|
POST
|
if you use the IObjectClassEvents OnDelete event instead of the editor extension, you can raise an unhandled exception. ArcGIS will pick up on the exception, abort the operation and show the user the message of the exception. That way the operation is aborted, map and database stay the same and the operation is not in the stack.
... View more
12-15-2011
09:59 AM
|
0
|
0
|
1404
|
|
POST
|
I have done this in the past by writing my own data adapter. If you can cycle through your feature layer, you I assume you have some sort of cursor. A cursor has a list of fields. These fields have properties such as data type, length, etc. .Net datatables also have fields, called columns that are of different type. So create a new datatable, cycle through the fields and for each one create a column in the datatable with equivalent types. The cycle through the cursor, adding a row in the datatable for each row in the cursor, and set each column of the row to the value of the corresponding field in the cursor row. The bind the datatable to the datagridview. If the user is going to edit the datagridview, you are going to need to write the code to put the changes back into the featureclass. It is a little tedious and the performance is lackluster but it works. Watch out for the nullable property on the field. If the cursor is created with an outer-join query, the field reports the nullable value of the base table, which could not allow null value and could very well have null values in the cursor for that field (due to the outer-join.) I remember getting snagged by that because we created a column that doesn't all null values, then tried to cram null values into it and got an exception.
... View more
12-08-2011
11:26 AM
|
0
|
0
|
1558
|
|
POST
|
I was thinking more along the lines (this is approximate code)
Dim i As Integer
For i = 0 To pTinAdv.TriangleCount -1
Set pTinTriangle = pTinAdv.GetTriangle(i)
dim poly as IPolygon
set poly = new polygon
'set polygon spatial reference
dim polyPtColl as IPointCollection
set polyPtColl = poly
dim pt as IPoint
set pt = new Point
'set point spatial reference (same as TIN)
dim j as integer
for j = 0 to 2
pTinTriangle.Node(j).QueryAsPoint pt
polyPtColl.AddPoint(pt)
next
poly.Simplify
Set pPolyLayer = pScene.Layer(1)
Set pPolyFC = pPolyLayer.FeatureClass
Set pFeat = pPolyFC.CreateFeature
On Error Resume Next
Set pFeat.Shape = poly
pFeat.Store
Next
You may also write something like this:
Set pTinTriangle = pTinAdv.GetTriangle(i)
dim ring as Iring
pTinTriangle.QueryAsRing ring
dim poly as IPolygon
set poly = new polygon
'set poly spatial reference (same as TIN)
dim polyGeoColl as IgeometryCollection
set polyGeoColl = poly
polyGeoColl.AddGeometry(ring)
poly.simplify
'set shape on feature
... View more
12-06-2011
10:01 AM
|
0
|
0
|
1411
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-02-2024 10:26 AM | |
| 1 | 07-05-2024 08:45 AM | |
| 1 | 10-05-2022 02:19 PM | |
| 6 | 03-27-2017 01:16 PM | |
| 1 | 05-05-2016 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-28-2025
07:37 AM
|