|
POST
|
Hi All, Has anyone else run into this? I have a view in Oracle that I am using for an x,y event layer in ArcMap (and by way of publishing, a mapping service). I have over 21K rows in the view when I query in Oracle. When I open the layer file in ArcMap, I SEE all of the points (at least the ones that have valid x y coords - there are a few nulls), but when I open the attribute table there are only 2048 in the list. Yet, I can go to one that is not showing in the attribute list and do an info tool and get the data. What kind of quirkiness is this? ETA: Win7 x64, Arc10 SP1, Oracle 10g, our server for SDE is SQL Server 2008 Thanks. Row 2048 is suspicious, since that is the default number of rows fetched by the table when it opens to preserve performance (why retrieve all rows if you don't actually look at them and just need to do a calculation or something in the first few records). When you get to that row it does not always respond to arrow or page down keyboard events. Try pressing the Last Record button in the table. That should take you to the real last row in your table and then you should be able to page or arrow through the full record set. It is a bug that they got partially fixed, but occassionally it still occurs (harder to replicate however, so harder to get Esri to fix it).
... View more
11-09-2011
09:20 AM
|
0
|
0
|
2320
|
|
POST
|
I need to be able to determine the same information that is made visible when a user opens the property window of a Feature Class. The property windows knows whether to add Z and/or M properties to the tabs and pages if those options are enabled. This works on a Feature Class with no features, so it has to be something that can be tracked from the feature class and its spatial reference. I have used the IGeodataset interface to get access to the Feature Class spatial reference, but I do not know how to use that information to determine if Z and M options have been enabled. The HasZPrecision and HasMPrecision seem to only return false for my data if both Z and M options are disabled. If either is enabled, I seem to get true for both, even if one is disabled. This may be due to the way the data was created intially, but I am not sure. Nonetheless the properties for the feature classes I have tested correctly show only the properties for the option that is actually enabled. Any ideas how to figure this out without having a feature of the feature class to query? Basically how does the Feature Class property window know which checkbox was checked on the General tab concerning Z and M when there are no features in the Feature Class to query. Thanks.
... View more
11-09-2011
08:42 AM
|
0
|
2
|
1657
|
|
POST
|
Jacob: Do you know if the method you used would preserve circular, elliptical and bezier polyline geometries? I know that most attempts to use arcpy to deal with such geometries at the segment level result in loss of this type geometry information. I need to query each point X,Y,Z and M values and part segment lengths in a polyline rather than just interpolate from the ends and need to preserve the non-linear geometries. Can this be done in arcpy, or is that only possible in ArcObjects. (The help suggests that arcpy cannot be used to access low level geometries, so I tend to think the answer is no).
... View more
11-09-2011
08:20 AM
|
0
|
0
|
1728
|
|
POST
|
Just for anyone's information, I have been on the phone with ESRI support and after many hours gotten an Add-In Application Extension to behave the way I wanted when its original AutoLoad property is set to False (the default wizard setting for an Application Extension). I found that after the initial time the extension is used, whatever state the user left the Extension Manager in or the add-in UI element (dockable window open, button customized to a toolbar) is persisted when ArcMap is closed and will reappear in that state the next time ArcMap is opened. If you have tried the Custom Selection Extension sample, you might be led to believe that the extension checks to see if it is enabled automatically when ArcMap restarts, since this code appears to automatically fire the Extension's OnStartup method. However, this is not really the case. If the user left an Add-In Application Extension enabled when they closed ArcMap the OnStartup() method only fires if it is triggered by specific code contained in a UI Add-in type that fires its New method the next time ArcMap is opened. In the sample above this is only accomplished if the toolbar opens immediately when ArcMap starts. In that case, the toolbar registers its Add-in components, which in turn fire code to check the extension state, which then makes the extension actually fire it's Startup Method as ArcMap opens. Anyway, if everytime ArcMap starts you want an Add-In dockable window the user left open to check to see if the Add-In Application Extension is enabled here is my suggested minimum code for the Dockable Window (all the code below will do is switch visibility between a label and a combobox on the dockable window depending on the Extension state when ArcMap opens or the extension is enabled or disabled in the Extension Manager): Public Class MyDockableWindow
Inherits UserControl
Private Shared s_label As Label
Private Shared s_combobox1 As System.Windows.Forms.ComboBox
Private Shared s_enabled As Boolean
Public Sub New(ByVal hook As Object)
InitializeComponent()
Me.Hook = hook
s_label = label1 ' set a shared variable to a label on the dockable window
s_comboBox1 = comboBox1 ' set a share variable to a combobox on the dockable window
' Have the extension check its enabled status
MyExtension.IsExtensionEnabled() ' replace "MyExtension" with your actual extension name.
End Sub
' Method called by the extension to set the state of the dockable window
Friend Shared Sub SetEnabled(ByVal enabled As Boolean)
MyExtension.IsExtensionEnabled()
s_enabled = enabled
' if the dockable window was never displayed, combobox could be null
If s_combobox Is Nothing Then
Return
End If
If enabled Then
s_label.Visible = False ' label saying extension is disabled appears
s_combobox1.Visible = True ' a combobox control appears if the extension is enabled
Else
s_label.Visible = True ' Label saying extension is disabled disappears
s_combobox1.Visible = False ' a combobox control disappears if the extension is disabled
End If
End Sub
''' <summary>
''' Host object of the dockable window
''' </summary>
Private privateHook As Object
' Standard code added by the Add-In dockable wizard
End Class Then in the Add-In Application Extension here is my minimum suggested code: Public Class MyExtension ' replace with actual extension name
Inherits ESRI.ArcGIS.Desktop.AddIns.Extension
Private Shared s_dockWindow As ESRI.ArcGIS.Framework.IDockableWindow
Private Shared s_extension As MyExtension ' replace with actual extension name
' Overrides
Protected Overrides Sub OnStartup()
s_extension = Me
' Wire up events. Example events are commented below. They require additional code.
' AddHandler ArcMap.Events.NewDocument, AddressOf ArcMap_NewOpenDocument
' AddHandler ArcMap.Events.OpenDocument, AddressOf ArcMap_NewOpenDocument
Initialize()
End Sub
Protected Overrides Sub OnShutdown()
Uninitialize()
' Reverse whatever events you wired up. Examples events are below They require additional code.
' RemoveHandler ArcMap.Events.NewDocument, AddressOf ArcMap_NewOpenDocument
' RemoveHandler ArcMap.Events.OpenDocument, AddressOf ArcMap_NewOpenDocument
s_dockWindow = Nothing
s_extension = Nothing
MyBase.OnShutdown()
End Sub
Private Sub Initialize()
If s_extension Is Nothing Or Me.State <> ExtensionState.Enabled Then
Return
End If
' Reset event handlers. Examples are commented below. They require additional code.
' Dim avEvent As IActiveViewEvents_Event = TryCast(ArcMap.Document.FocusMap, IActiveViewEvents_Event)
' AddHandler avEvent.ItemAdded, AddressOf AvEvent_ItemAdded
' AddHandler avEvent.ItemDeleted, AddressOf AvEvent_ItemAdded
' AddHandler avEvent.ContentsChanged, AddressOf avEvent_ContentsChanged
' Update the UI
MyDockableWindow.SetEnabled(True)
End Sub
Private Sub Uninitialize()
If s_extension Is Nothing Then
Return
End If
' Detach event handlers. Examples are commented below.
' Dim avEvent As IActiveViewEvents_Event = TryCast(m_map, IActiveViewEvents_Event)
' RemoveHandler avEvent.ItemAdded, AddressOf AvEvent_ItemAdded
' RemoveHandler avEvent.ItemDeleted, AddressOf AvEvent_ItemAdded
' RemoveHandler avEvent.ContentsChanged, AddressOf avEvent_ContentsChanged
' avEvent = Nothing
' Update the UI
MyDockableWindow.SetEnabled(False)
End Sub
Friend Shared Function GetDockableWindow() As ESRI.ArcGIS.Framework.IDockableWindow
If s_extension Is Nothing Then
GetExtension()
End If
' Only get/create the dockable window if they ask for it
If s_dockWindow Is Nothing Then
Dim dockWinID As UID = New UIDClass()
dockWinID.Value = ThisAddIn.IDs.MyDockableWindow
s_dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID)
End If
Return s_dockWindow
End Function
Protected Overrides Function OnSetState(ByVal state As ExtensionState) As Boolean
' Optionally check for a license here
Me.State = state
If state = ExtensionState.Enabled Then
Initialize()
Else
Uninitialize()
End If
Return MyBase.OnSetState(state)
End Function
Protected Overrides Function OnGetState() As ExtensionState
Return Me.State
End Function
Friend Shared Function IsExtensionEnabled() As Boolean
If s_extension Is Nothing Then
GetExtension()
End If
If s_extension Is Nothing Then
Return False
End If
Return s_extension.State = ExtensionState.Enabled
End Function
Private Shared Function GetExtension() As MyExtension ' replace the "MyExtension" type with your actual extension's name
If s_extension Is Nothing Then
Dim extID As UID = New UIDClass()
extID.Value = ThisAddIn.IDs.MyExtension ' replace the "MyExtension" type with your actual extension's name
' Call FindExtension to load this just-in-time extension.
ArcMap.Application.FindExtensionByCLSID(extID)
End If
Return s_extension
End Function
End Class Finally here is a button to launch the dockable window. Public Class MyButton
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
Dim dockWindow As ESRI.ArcGIS.Framework.IDockableWindow
dockWindow = MyExtension.GetDockableWindow()
If dockWindow Is Nothing Then
Return
End If
dockWindow.Show((Not dockWindow.IsVisible()))
End Sub
Protected Overrides Sub OnUpdate()
Me.Enabled = MyExtension.IsExtensionEnabled()
End Sub
End Class
... View more
11-08-2011
02:27 PM
|
0
|
0
|
3729
|
|
POST
|
Check out this help link. It indicates that if you provide a cursor object with the Spatial Reference desribed from a feature class (a Projected Coordinate System in your case giving Linear Units in meters) and then convert the cursor to another Spatial Reference (a Geographical Coordinate System giving units in Decimal Degrees) the output of the cursor will convert the input feature coordinates to the new coordinate system. Should work with any pair of Coordinate Systems (Projected or Geographic). This may not work in the field calculator, but it would work in a Python script that could be used in Model Builder or with Windows Scheduler for the automation. If you open the properties of your feature class you should see the Projected Coordinate System it is using and the Linear Units it uses (meters). It should also indicate a Geographic Coordinate System that underlies the Projection based in Angular Units (usually Decimal Degrees). That would be the natural transformation to use unless you were specifically trying to match another Geographic Coordinate System, such as the one Google users. I hope this helps.
... View more
11-06-2011
11:24 AM
|
0
|
0
|
831
|
|
POST
|
Here is what Melita Kennedy gave in response to a similar question I had about converting Angular Units (degrees) into Linear Units (km, miles, meters, feet, etc.): "I know the 3D team calculates a conversion value when horizontal coordsys is geographic to match up with the z values. It helps that data is usually large scale, so you can make an assumption. A rough equivalency is that 1 deg north-south is about 110 km. However, this only holds east-west at the equator. A rough estimate for east-west is 110 km * cos(latitude). Thus, at 60N or 60S, a degree is around 55 km. How the 3D team balances that out, I don't know." Latitude is the Y coordinate. You should not use the VBA method of extracting point data anymore, because at ArcGIS 10 it does not work in the field calculator, only Python will work. So for Python using Melita's formula your Y coordinate would be: 110 * cos(!shape.Y!) * #unit_conversion_factor# Replace the #unit_conversion_factor# above to be the unit conversion factor that will convert from km to the linear units that you ultimately want. For example, km to meters is 1000, and km to feet is approximately 3280.838862. Edit: (This is backwards from what you want to do. Sorry.)
... View more
11-06-2011
07:07 AM
|
0
|
0
|
831
|
|
POST
|
See also this link for string fields. It seems you should use field.value = dbNull.value.
... View more
11-05-2011
09:52 PM
|
0
|
0
|
976
|
|
POST
|
How does one set a row value to null? pRow.Value(i) = "" sets it to an empty string pRow.Value(i) = nothing also sets it to an empty string pRow.Value(i) = system.dbnull generates an error in the field calculator you can create an expression like Field1 = null and it will set the values to Null, but how do you do it in .NET? Check out this link. It seems to list a way to generate a null value, at least for date fields. Let me know if this points you in the right direction.
... View more
11-05-2011
09:42 PM
|
0
|
0
|
976
|
|
POST
|
Code for Projected Coordinate Systems should work fine for me. I will double-check that my data has linear units instead of angular, if not I am fine projecting them to try out the tool. Also, my routes are all continuous and do not contain any gaps, so I won't need to worry about that functionality for now. Thanks for all of your work on this. I am very curious to try it out! Just giving an update on where I am at on this tool. The code is working on Projected Systems where all Z values are assigned (no NaN values) and the X/Y and Z units are defined. It recognizes how to convert units to the X/Y standard when Z uses a different unit type (which I found out the ICurve3D interface provided by ESRI does not do). It also is able to optionally project a straight line 3D length value across gaps in multi-part lines and apply a user specified Measure multiplier and/or an initial Measure offset. For the interface I am sticking with building an Add-In. I plan on building an Extension to listen to map events so that the toolbar can populate a combobox list of qualifying layers. The rest of the toolbar will be enabled if at least one layer qualifies for the tool. I will have two other comboboxes where the measure multiplier and measure offset will be initialized to 1 and 0 respectively and allow user input. Three additional buttons will also be on the toolbar. One will allow the user to toggle if they want 3D distances projected across gaps in multi-part lines, the second will toggle the operation so that it occurs only on selected features or on all features (without having to change the current feature selection), and the third will execute the operation. By default the operation will occur on selected features only and the tool will always respect a layer's definition query even when it is allowed to process all layer features, whether selected or not. The code currently works inside or outside of an edit session with non-SDE features. I need to add code to detect when a layer is an SDE feature class and only allow the operation to process if an edit session has been initiated for the layer and it is editable. I also need to add more error trapping in case something unexpected got by me to avoid nasty ArcMap crashes (which are very easy to cause). I plan on releasing it with the known limitation that it will not initially work on GCS feature classes and it will be using a simple NaN Z interpolation method. If NaN Z values occur on any vertice of the line I plan on treating the Z value as if it held the preceeding Z value the tool last read and where the Z value of the first vertice is NaN I will assume an elevation of 0. NaN Z values will not be changed by the tool, they will will just take on assumed values during the tool operation for the purposes of assigning M values. I plan on reporting how many lines required NaN Z interpolation when the tool finishes if any Z interpolation was required. After I get some feedback on the user friendliness of the design and the effectiveness of the tool with PCS feature classes I will try to enhance the tool to deal with the above limitations. At that point I also will consider offering a variety of Z interpolation options for processing NaN Z values and give the user an option to update the NaN Z values at the same time that the tool assigns the M values. I hope this sounds good to anybody watching this thread (like Jeffrey).
... View more
11-04-2011
04:47 PM
|
0
|
0
|
2878
|
|
POST
|
Here are the crucial interfaces and code to derive the SDE connection of a Feature Class (I believe it should also work for a table if you assign the Table from the IStandaloneTable to the Dataset) to set up SDE editing without knowing the connection properties (Code is VBA, but basically the same as VB.Net if the Set keywords are removed): Dim pDataset As IDataset
Dim pWorkspace As IWorkspace ' Added interface to set up SDE editing
Dim pFeatureWorkspace As IFeatureWorkspace ' Added interface to set up SDE editing
Dim pWorkspaceEdit As IWorkspaceEdit ' Added interface to set up SDE editing
Dim pAnnoLayer As IAnnotationLayer
' Assume I have a valid Annotation layer assigned to the pLayer variable
Set pAnnoLayer = pLayer
Set pDataset = pAnnoLayer ' the SDE layer from the map.
'*********************************
' Verify Workspace is in an Edit state
'*********************************
Set pWorkspace = pDataset.Workspace
Set pFeatureWorkspace = pWorkspace
Set pWorkspaceEdit = pFeatureWorkspace
If pWorkspaceEdit.IsBeingEdited Then
pWorkspaceEdit.EnableUndoRedo
pWorkspaceEdit.StartEditOperation ' Editing Started
' Do your edits here
pWorkspaceEdit.StopEditOperation ' Editing completed
End If
... View more
11-04-2011
11:29 AM
|
0
|
0
|
791
|
|
POST
|
Hi all, I am trying to do an uncertainty analysis for some bathymetric survey data. We have both single-beam and multi-beam bathymetry, and I am looking to thin down the points brought in from an .xyz file from 0.25 m, to 5 m, to 10 m, etc. Basically, I am looking to plot divergence from point density. So, I have been playing around, and am not finding what seems like should be a fairly simple operation. Basically, I want to take mean values of a group of points (spaced about 25 cm) within a 5x5 m cell (for about 150 cells, created as polygons with a fishnet), and so on and so forth, for about 80 survey sites for both survey types. What I have for my test site is the raw survey data as a feature class (I used a Python script that imports a folder full of .xyz files, and outputs them as point feature classes in a file geodatabase), a fishnet of 5x5 m polygons clipped to the survey extent, and a feature-to-point layer, where a point is created in the center of each polygon. I am thinking that there should be some way to populate the z-value field that I added to the feature-to-point layer with the mean value of the raw points within each polygon. Any ideas? Thanks a bunch, Rob Not sure I followed all of that, but the Spatial Join tool seems like it can create a feature class that would have the IDs of both the points and the polygons. Then you can summarize the points on the polygon ID. If a second spatial join is needed to have the points in the center of the Polygon know about the polygon IDs then to that so you can join your summary data to the centroid points. (Or backward if needed as long as you are working with one to one or many to one joins).
... View more
11-03-2011
03:07 PM
|
0
|
0
|
884
|
|
POST
|
how do you join in case the excel file has data for multiple years, so then you have a one to many join? See my reply to your other post on this subject here.
... View more
11-03-2011
06:38 AM
|
0
|
0
|
1649
|
|
POST
|
Melita: Thank you for commenting on this thread. Your suggestions have helped me with PCS layers and have put me on the right track for GCS layers. If I get stuck I will post back here. Thanks again.
... View more
11-03-2011
06:27 AM
|
0
|
0
|
881
|
|
POST
|
I ran some code with a feature class that had X, Y, Z and M units to get lengths from the I3DCurve interface. I ran a test on a feature using a Projected Coordinate System where my initial X, Y and Z units were all in Feet_US and got the expected 3D length value. Then I modified the feature class to change the Z Units to meters, but I left the X/Y coordinate units in Feet_US. When I reran the code the 3D length reported by the I3DCurve interface did not change from the previous run when I had the Z units in feet. I made sure that the polyline I supplied to the interface had been assigned the feature class' Spatial Reference and made sure the Z values I tested were much greater than the change in X/Y so the difference in Z units would have an obvious impact, but that had no effect on the length that the I3DCurve reported. Here is my main loop code (variables are correctly Dimensioned to the correct types outside the loop) that produced no change in the reported length after I changed my Spatial Reference Z Units from Feet_US to meters. Am I missing something about how my code should be written to get the I3DCurve interface to recognize the change I made to the Spatial Reference of the Z units? If I am not than it seems that this interface either has a bug or an undocumented (and unexpected) behavior for its method of calculating the 3D length of the curve when a feature class has mixed X/Y and Z units. ' Assume a Polyline Feature that is Z and M Aware is assigned to pFeat, which is an IFeature
Dim pSpatialRef As ISpatialReference = pFeat.Shape.SpatialReference
If Not TypeOf pSpatialRef Is IProjectedCoordinateSystem5 Then
' Currently not able to process Geographic Coordinate System or Unknown
MsgBox("Spatial Reference Is Not A Projected Coordinate System")
Return
End If
pPolyline = New Polyline
pPolyline.SpatialReference = pSpatialRef ' Make sure Polyline has Spatial Reference
pPolyline = pFeat.Shape ' Assign geometry to Polyline
pCurve3D = pPolyline
pPointColl = pFeat.ShapeCopy ' Assign to pointCollection
pEnumVert = pPointColl.EnumVertices
pInPoint = New Point ' Reinitialize Input Point
pInPoint.SpatialReference = pSpatialRef
pEnumVert.Reset()
pEnumVert.QueryNext(pInPoint, lPart, lVert)
LastPoint = New Point ' Reinitialize Input Point
i = 1
Do While Not pInPoint Is Nothing
' For lPtCnt = 0 To pPointColl.PointCount - 1 ' For loop to access all curve points
If lPart = 0 And lVert = 0 Then
LastPoint = pInPoint
GapAdd = 0
End If
' pInPoint = pPointColl.Point(lPtCnt) ' Assign Input successive input Points
pCurve3D.QueryPointAndDistance3D(ESRI.ArcGIS.Geometry.esriSegmentExtension.esriNoExtension, pInPoint, False, pOutPoint, distAlong, distFrom)
If lVert = 0 And Not Ignore_Gaps Then
GapAdd = (Math.Sqrt((pInPoint.X - LastPoint.X) ^ 2 + (pInPoint.Y - LastPoint.Y) ^ 2 + ((pInPoint.Z - LastPoint.Z) * ZUnitFactor) ^ 2)) * Measure_Factor + GapAdd
End If
pEnumVert.put_M(distAlong + GapAdd) ' Modify M to be 3D distance along curve
' pPointColl.ReplacePoints(lPtCnt, 1, 1, pInPoint) ' Replace the point with its new M version'
If pEnumVert.IsLastInPart And pPointColl.PointCount <> i Then
LastPoint = pInPoint
pEnumVert.QueryNext(pInPoint, lPart, lVert)
ElseIf Not pEnumVert.IsLastInPart Then
pEnumVert.QueryNext(pInPoint, lPart, lVert)
Else
pInPoint = Nothing
End If
' pInPoint = Nothing
' Next lPtCnt
i += 1
Loop
pFeat.Shape = pPointColl
pFCursor.UpdateFeature(pFeat) ' Update the cursor
... View more
11-02-2011
10:19 PM
|
0
|
2
|
1004
|
|
POST
|
I found a method for casting the AddIn DockableWindow to an IDockableWindow as shown below. I want to ensure the width is at least 240 pixels and the code below works for the Floating state. However, nothing I have tried works for any of the docked states. Any ideas on how to stop a docked window from getting too narrow? Public Function GetAddInDockWindow(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.Framework.IDockableWindow
Dim dockWindowManager As ESRI.ArcGIS.Framework.IDockableWindowManager = CType(application, ESRI.ArcGIS.Framework.IDockableWindowManager)
Dim windowID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass
windowID.Value = My.ThisAddIn.IDs.DockWindow
Return dockWindowManager.GetDockableWindow(windowID)
End Function
Private Sub DockWindow_Layout(ByVal sender As Object, ByVal e As System.Windows.Forms.LayoutEventArgs) Handles Me.Layout
Dim dockableWindow As ESRI.ArcGIS.Framework.IDockableWindow
dockableWindow = GetAddInDockWindow(CType(m_hook, ESRI.ArcGIS.Framework.IApplication))
Dim windowPos As ESRI.ArcGIS.Framework.IWindowPosition = CType(dockableWindow, ESRI.ArcGIS.Framework.IWindowPosition)
If windowPos.State = ESRI.ArcGIS.Framework.esriWindowState.esriWSFloating And windowPos.Width < 240 Then
windowPos.Move(windowPos.Left, windowPos.Top, 240, windowPos.Height) ' works
ElseIf windowPos.Width < 240 Then
windowPos.Width = 240 ' doesn't work nor does Move for docked windows
End If
End Sub
... View more
11-02-2011
03:59 PM
|
0
|
0
|
536
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-24-2026 11:37 PM | |
| 1 | 03-24-2026 08:01 PM | |
| 6 | 02-23-2026 08:34 AM | |
| 1 | 03-31-2025 03:25 PM | |
| 1 | 03-28-2025 06:54 PM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|