|
POST
|
Just a word of caution in using the distances generated by the analysis I have proposed (and all of the other suggestions I have seen here). The distances reported would only really be true and accurate if there was no change in elevation due to either topography or flight ascent and descent. It is an accurate as-the-bird-flies distance only if the bird were capable of flying nearly at ground level and at a nearly constant elevation. I would tend to assume that adjustments for altitude would support using the shorter distances, because I would assume that the altitude between destinations would not have to be as high in most short distance flights. However, the distances for take-off and landing or climbs and descents due to terrain and building obstructions would not be accounted for without some kind of elevation data for each point (and possibly elevation data for tall obstruction points that might intervene between your destinations, such as mountains, tall utility obstructions, high-rise buildings, or no-fly restrictions for military bases or other sensitive instalations). As long as those disclaimers and limitations are noted, the distances obtained from the analysis I proposed are reasonable as an estimate for as-the-bird-flies distances.
... View more
01-29-2013
03:35 PM
|
0
|
0
|
4486
|
|
POST
|
I took my example a step further and after assuming an origin/destination, I was able to manually pick out the shortest non-duplicating path based on a sort of the segment lengths. Intuitively the result makes sense based on the picture, and if I rearrange any three segments joining three of the points together the total path would have to be longer than the one that is shown. So even without Network Analyst, this method makes it possible to do the analysis. Here is a screen shot of the shortest path. I can say the path is 7.99 miles long to make the return trip (after specifying that the starting points was at either the top most or the bottom most point of the set.) The color based on segment lengths also confirms the path is the shortest. 17 diffferent destinations (with the origin being the final 18th return trip destination) are connected by exactly 17 segments. The return trip is 3.89 mile ling, which under half of the total trip length. The average length of the segments is .47 miles long and the shortest segment is 216 feet or 0.04 miles long.
... View more
01-29-2013
01:26 PM
|
0
|
0
|
4486
|
|
POST
|
Actually not, that will not be problem. This is short distance flying with helicopters, in a limited area with many locations spread out. As the distance is so short, a linear distance in the projected map is just fine. My big problem is how to calculate and present the order that will result in the shortest total distance I don't deal with flight paths, but this sounded like an interesting problem that expands the potential interplay of intermodal transportation networks, which is a problem transportation analysts like myself are supposed to tackle. I beleiev you can convert your potential flight paths into a network that Network Analyst can use to do the analysis. Here is how you can create the network and eliminate duplicate reversed lines (so each segment can function as a two-way street in effect). You already have all of the points and they all identify the helicopter associated with them. So here is what I would do with them: 1. Make sure the point data is in a geodatabase. I prefer a file geodatabase for precision and processing speed. 2. Add an integer field to your point data named ORIG_ID and calculate the ObjectID values of the points into it. 3. If your points are using a Geographic Coordinate System (i.e, using coordinates in degrees like Longitute and Latitude), then create a reprojected copy into a Projected Coordinate System (using Linear Coordinates, like a State Plane projection). This will allow you to calculate linear distances between points, since you are not needing to account for geodesic distances. 4. Add two double fields for your X and Y coordinates and use the Geometry Calculator to calculate the projected point coordnate values into the fields. 5. Make a copy of the projected coordinate system point data into the same geodatabase with a slightly different name. 6. Use Make Query Table to do a many to many join of the point data to its duplicate. You do not want include the shape field so that the output is just a Standalone table. To create all of the point pairs for a given helicopter set the query criteria to be something like this: orig.HelicopterID = copy.HelicopterID 7. Select from the Query Table all records where orig_OBJECTID < copy_OBJECTID to get all paths that will not have a reversed duplicate or from the point to itself. Export the results of that selection to a Standalone Table. 8. Add a field called PATHID and calculate the OBJECTID of the exported matched output into it. 9. Use the Make X/Y event Layer with the X and Y coordinates from the Original X/Y coordinates. Export that point set. 10. Use the Make X/Y event Layer with the copy X and Y coordinates. Export that point set. 11. Merge the two points sets together. 12. Use the Points to Line tool to create segments between all points that will not be duplicated (assuming you had no overlapping points to begin with) using the PATHID value as the LINE ID of the tool and the sequence as the ObjectID of the merged points. 13. Add a field to the paths for HelicopterID to the paths. Join the Paths back to one of the unmerged Point outputs using the PATHID as the join field and calculate over the associated HelicopterIDs. Now you can select all of the paths possible for the helicopter to travel and will have the length field to tell you how long each segment is. You should also be able to transfer any other information you want that came from the original points that tie to each path using this join. The result would look something like the attached screenshot (created from all node points along a roadway as a demonstration of the concept). The colors of the segments reflect their relative lengths and just one set of segments is shown related to a single roadway (like showing a single helicopter). These are all of the possible straight line as the bird flies paths between nodes. Network Analyst can most likely be set up with constraints that would keep the helicopter on its possible flight paths and also account for each point accessible along the possible path to solve for the shortest distance. Constriants such as specifying an origin point and whether to make the end point a return to the origin point should also be possible. I hope this helps.
... View more
01-29-2013
12:35 PM
|
0
|
0
|
4486
|
|
POST
|
Apparently this behavior is not limited to using an Add-In or a Windows Form. The mere act of starting and stopping Customize Mode without doing anything else causes the frozen Layout behavior. Or just pressing a user created Add-In button on a toolbar that does absolutely nothing causes the behavior. (Buttons created by ESRI do not seem to have this problem, just user Add-In buttons). At this point it seems clear to me that this is a fundamental bug in the Desktop application affecting all user customizations and that it is not tied to any particular kind of user customization. I would consider this to be a serious issue that indicates that the overhaul of user customizations that occured in 10.0+ was poorly implemented compared to previous versions.
... View more
01-29-2013
06:16 AM
|
0
|
0
|
1236
|
|
POST
|
I have an Add-In that contains a button that launches a Windows Form as a Modal Dialog (ShowDialog). When I close the form (whether or not I have caused the form to run any code beyond launching itself), I am unable to select any Layout Elements (i.e., Data Frame, Title Text, Scale Bar, North Arrow, Drawn Graphics, etc). The Layout elements can only be selected again if I press the Layout View menu item again on the View Menu, or switch back and forth between Data View and Layout View. The form only has Radio Buttons and Cammond Buttons and no code is loaded at start up other than to initialize a module level MxDocument variable. The Cancel button does a ReleaseComObject of the module level variables and then a Me.Close. After the Dialog closes itself the start-up add-in button processes Dispose on the form. I don't know of any way to avoid this behavior. I am using 10.1 SP1. The behavoir also occurred when I was running 10.0. Has anyone else experienced this? Does anyone have a fix beyond the work around I mentioned? Thanks.
... View more
01-28-2013
02:25 PM
|
0
|
5
|
2968
|
|
POST
|
David: I have modified your replacement DataStatistics code slightly. I have added a new property that returns an UniqueValueCount so that the class supports the use of a For loop in the same way as IDataStatistics. Your Interface declarations were misspelled. It read IDataStatiticsECL and not IDataStatisticsECL. That error made it harder to incorporate into my code that used the IDataStatistics interface. The spelling correction below makes it easy to just append "ECL" to the appropriate places in code that uses the broken IDataStatistics interface. This fixed the crashes and memory errors I was having with the IDataStatistics interface, so I appreciate the code you posted. It saved me a lot of time. Overall the performance of the new code seem fairly good, but if any one has performance enhancement suggestions, I am also intersested. Here is the revised code: Imports ESRI.ArcGIS.Geodatabase
Public Interface IDataStatisticsECL
WriteOnly Property Cursor() As ESRI.ArcGIS.Geodatabase.ICursor
Property Field() As String
ReadOnly Property UniqueValues() As System.Collections.IEnumerator
ReadOnly Property UniqueValueCount() As Integer
End Interface
Public Class DataStatisticsClassECL
Implements IDataStatisticsECL
Private m_Cur As ESRI.ArcGIS.Geodatabase.ICursor
Public WriteOnly Property Cursor As ESRI.ArcGIS.Geodatabase.ICursor Implements IDataStatisticsECL.Cursor
Set(ByVal value As ESRI.ArcGIS.Geodatabase.ICursor)
m_Cur = value
End Set
End Property
Private m_Field As String = ""
Public Property Field As String Implements IDataStatisticsECL.Field
Get
Return m_Field
End Get
Set(ByVal value As String)
m_Field = value
End Set
End Property
Public ReadOnly Property UniqueValues As System.Collections.IEnumerator Implements IDataStatisticsECL.UniqueValues
Get
Dim row As Row = CType(m_Cur.NextRow(), Row)
Dim dic As New SortedList(Of Object, String)
Dim iFeild = row.Fields.FindField(m_Field)
'loop through the data and get the unique values
Do Until row Is Nothing
If dic.ContainsKey(row.Value(iFeild)) = False Then
dic.Add(row.Value(iFeild), "")
End If
row = CType(m_Cur.NextRow(), Row)
Loop
Dim arr(dic.Count - 1) As Object
Dim arrInd As Integer
dic.Keys.CopyTo(arr, arrInd)
m_UniqueValueCount = arr.Length
Dim n As New ValuesEnum(arr)
Return n
End Get
End Property
Private m_UniqueValueCount As Integer = 0
Public ReadOnly Property UniqueValueCount As Integer Implements IDataStatisticsECL.UniqueValueCount
Get
Return m_UniqueValueCount
End Get
End Property
Private Class ValuesEnum
Implements IEnumerator
Private ReadOnly m_Values() As Object
Private m_Cur As Integer
Public Sub New(ByVal lst() As Object)
m_Values = lst
m_Cur = -1
End Sub
Public ReadOnly Property Current() Implements IEnumerator.Current
Get
If m_Cur >= m_Values.Length Then
Return Nothing
End If
Return m_Values(m_Cur)
End Get
End Property
Public Sub Reset() Implements IEnumerator.Reset
m_Cur = -1
End Sub
Public Function Movenext() As Boolean Implements IEnumerator.MoveNext
m_Cur = m_Cur + 1
If m_Cur < m_Values.Length Then
Return True
Else
Return False
End If
End Function
End Class
End Class
... View more
01-28-2013
06:45 AM
|
0
|
0
|
2612
|
|
POST
|
Richard, Did you see this thread that discovered the bug NIM087476 �??Memory leakage ESRI.ArcGIS.Geodatabase.IDataStatistics using UniqueValues property with ArcGIS 10.1 with SP1�?� Thanks for pointing that out. I had not seeen this thread, but this explains why it worked at 10.0 and not at 10.1 SP1 (I skipped 10.1 original). I will reengineer the code to use a cursor to get unique values. Can anyone pioint me to any threads that show the most elegant techniques for doing that?
... View more
01-28-2013
05:33 AM
|
0
|
0
|
1002
|
|
POST
|
I wrote an Add-In that used a Windows form and many chained functions that create and release cursors using ReleaseComObject. Two of the functions use IDataStatistics, which takes a populated cursor as a parameter. When I was targeting ArcGIS 10.0 it all worked fine. Now with 10.1 I am getting a lot of errors about trying to access protected memory, which the MSDN help suggests is due to memory corruption, usually related to unmanaged code. The error help suggests that the memory corruption may be accumulating through many operations before triggering the error. The failure seems to always happen on the second or third pass that is triggered by user form updates and occurs within the subroutines that have the cursor that feeds to an IDataStatistics object. The error either appears when I call the UniqueValues method of the IDataStatistics object or when I do a Search on the feature cursor before it is passed to the IDataStatistics object (only on the second or third time through the code, never the first). Its behavior can be altered by the use or lack of use of the ReleaseComObject statements for the cursor or the IDataStatistics. I have tried all of the combinations I can think of and orders of the releaser. Below is a sample of how the code is written with the two lines where the protected memory error can occur shown in Red. Any suggestions on what objects I should use the ReleaseComObject on and the order or placement of that code or how to trap these errors and issolate the real cause? Private Sub GetRoutesList()
' Set Up Query Filter for the Full Date Range of the Collision Layer respecting PDO and DUI flags
Dim pQF As IQueryFilter = New QueryFilterClass
pQF.WhereClause = "NOT " & fldCollisionDate & " IS NULL" & whereSeverity & whereDUI
pQF.SubFields = fldCollisionDate & ", " & fldPrimaryRoad & ", " & fldRID & ", " & fldSeverity & ", party_sobriety_1, party_sobriety_2"
' Query Collisions Date Range and Street to fill Route Combobox List
pQF.WhereClause = fldCollisionDate & " >= date '" & m_FromDate.ToString("yyyy-MM-dd HH:mm:ss") & "' AND " & fldCollisionDate & " <= date '" & m_ToDate.ToString("yyyy-MM-dd HH:mm:ss") & "' AND " & fldRID & " > ' ' AND Upper(" & fldPrimaryRoad & ") = '" & m_strPrimary & "'" & whereSeverity & whereDUI
Dim dataStatisticsRoutes As IDataStatistics = New DataStatisticsClass
Dim featCursorRouteList As IFeatureCursor = m_FLCollisions.Search(pQF, True)
' Use DataStatistics to get Unique Values
dataStatisticsRoutes.Field = fldRID
dataStatisticsRoutes.Cursor = featCursorRouteList
Dim pEnum As System.Collections.IEnumerator = dataStatisticsRoutes.UniqueValues()
' Fill the Combobox and suspend refresh until list is populated
cboRoutes.BeginUpdate()
' Clear the Routes Combobox
cboRoutes.Items.Clear()
' Reset the enumerator before trying to access its values
pEnum.Reset()
' Read each Unique value and populate the Route list. Sorting is handled by a Combobox property.
For i As Int32 = 0 To dataStatisticsRoutes.UniqueValueCount - 1
pEnum.MoveNext()
cboRoutes.Items.Add(UCase(pEnum.Current()))
Next i
' Release the QueryFilter
If Not pQF Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(pQF)
End If
' Release the dataStatistics
If Not dataStatisticsRoutes Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(dataStatisticsRoutes)
End If
' Release the Cursor
If Not featCursorRouteList Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(featCursorRouteList)
End If
' Allow the Combobox to refresh
cboRoutes.EndUpdate()
If cboRoutes.Items.Contains(m_strRoute) Then
' Set Combobox Text to the current Map Route
cboRoutes.Text = m_strRoute
ElseIf cboRoutes.Items.Count > 0 Then
' Set Combobox Text to First Route in the List
cboRoutes.Text = cboRoutes.Items(0)
m_strRoute = cboRoutes.Text
End If
End Sub
There are many other cursor calls that do not involve IDataStatistics and other Com objects from ArcGIS being created in the code. None of the cursors are embedded in each other and I have always used the ReleaseComObject call after I finish reading the cursor. These cursors have not generated errors so far, but I need to be sure they are not contributing to the problem. Any suggestions are appreciated.
... View more
01-24-2013
02:29 PM
|
0
|
0
|
1002
|
|
POST
|
This is a screenshot I want to inquiry to know the distance betweeen ex: 119-107 (Shortest road) 172-136 148-117 .. etc. Blue Points are in a Shape File Road (Red & Green) are in a Shape file. [ATTACH=CONFIG]20992[/ATTACH] You are describing a Network Analyst problem. You need that extension to trace road segments between two destinations along the shortest path. You also have to create a Network Dataset from your road network to use the tool. Look in the help for Network Analyst and then you may want to go to that Forum topic to ask more questions.
... View more
01-23-2013
12:14 PM
|
0
|
0
|
1761
|
|
POST
|
Hello, I am fairly new in ArcGIS. I am wondering if there is a short-cut way of connecting closely spaced lines. I mean I have hundreds of lines (pathway for example), but some of the lines are not connected (small gaps exist between some lines). How can I connect those? I know I can manually connect by extending one line or drawing a new one in between, but it would require lot of time as I have hundreds. If you know a simple way of doing this (connect line if the distance in between xxx), I will be pleased to know. Thanks Shafayat If you have an Standard (ArcEditor) or Advanced (ArcInfo) licence you can use the Extend Line tool to do the whole feature class at once. If you have a Basic (ArcView) license then I am not sure what 3rd party tools or scripts are out there. But hopefully if you are maintaining data you really should get access to more than a Basic license (at least within your organization).
... View more
01-23-2013
11:33 AM
|
0
|
0
|
1039
|
|
POST
|
I've been using ESRI products since ARC/INFO 3. I recall being able to perform a join or setup relationships between tables using different techniques. For example indicating the data in the related column is sorted and thus you could use the ORDERED option. This naturally sped up the join or relate a great deal. I'm using the following python code... arcpy.JoinField_management(pointFC, "joinfld_name", pointattributes, "joinfld_name") to join a table of 200,000 records to a point FC of exactly the same number of records (i.e. 1:1 match). This join takes more than 25 minutes. I suspect it takes so long because it's not performing any intelligent searching on the join column of the "pointAttributes" table. Instead it's just doing a brute force search. I've tried creating an attribute index on both columns but this didn't seem to help. All of the data is in the same fGDB. I'm running Windows 7 with ARcGIS 10.0 on a relatively new laptop. Thanks for any help. Regards, Brian JoinField_Management is permanantly and directly physically altering the input table and writing it to disk. That will take a long time, indexed or not. If you are only wanting a join like you would create through the context menus in the Desktop and expecting that kind of performance, then you need to use AddJoin_management, not JoinField_Management. The AddJoin_Management tool creates an in memory join that is not written to disk unless you copy or export it. In memory processes are many orders of magnitude faster than any process that writes to disk. I hope this helps.
... View more
01-13-2013
07:36 PM
|
0
|
0
|
752
|
|
POST
|
Hi there, I am building an optimization tool, Just wondering if anyone knows how to: Firstly, export classified values into separate feature classes (i.e. I classify points using symbology, now I want to export those classes as separate shapefiles).. without having to go in and manually select by attribute. Secondly, Use an iteration, either in modelbuilder or python to iterate the break values of the aforementioned classified feature class. I think this is tricky because it requires the manipulation of the symbology window, which I'm not sure is possible in modelbuilder. Some background / context: What I'm looking to do is classify points by angle, into 5 different quantile classes. Export those, connect them using least distance, evaluate them based on landuse and water / pipe crossings (give the path a value based on its desirability) then go back to the point shapefile and reclassify, slightly shifting the break values in the quantile classification until all possible sequences are found and evaluated. The tool will then choose the lowest value as the most desirable and ta da we have an optimized layout! Any ideas would be much appreciated, if my question doesn't make any sense please let me know and I'll clarify!! Thanks! Make it easier on your self. Create a new long or text field to hold a value representing your 5 different quantile classes and create a single Code Blocked field calculator expression with if clauses that test each record for which of the five classes the value occurs in. You may want to add a test for Null values as well to avoid an error when that occurs. Now with that field you should have options to break apart separate feature classes in a variety of ways.
... View more
01-08-2013
03:29 PM
|
0
|
0
|
587
|
|
POST
|
I have looked into that. The problem is for every point I have 2 sets of coordinate points (that are not displayed) within the attribute table that I want that specific point to connect to. So I have my original point data, and then I used the near tool to get coordinates of the closest rail segment, and also road segment that I want to connect to. Those two sets of coordinates are not points yet because I do not know how to display multiple attribute columns of coordinates. I feel like that is pretty elementary but I cannot find a tool to do it. Moral of the story is each point has two other sets of coordinates in its' attribute row and I want to connect that point to those two XY coordinates. What you have is fine. First add two long fields. Make one an ID field and calculate the ObjectIDs of the original points into that field. The other field will be an Order field for your master set of points and populate it with a value of 1 for the original point (or 2 if it is supposed to be an angle point between the rail and road points). You then just need to create some temporary layers and point feature classes (possibly export a standalone table only from the points from within the tableview you have open in your screen shot). Use the Make XY Event Layer tool twice with the standalone table, once for the rail Long/Lat and the other for the Road Long/Lat to convert the attributes to an in memory point layer. Next Export from the TOC (not the tableviews) each of these layers to create real point feature classes. Now recalculate the Order field of these new point feature classes to be 2 for one of the new feature classes and 3 for the other (or 1 for the first and 3 for the other if the original points was the angle point). Now use the Append tool to join them to the original point layer (or make a copy of the original point feature class in ArcCatalog and use the Append tool to append the new points to that feature class). Now you can use the Points to Line tool with this data, using the ID field value as the line ID and the Order field to make your three point angled line follow the correct path. This is the way Geoprocessing usually works. Use lots of small tool steps that build on each other and that create temporary feature classes. Stop looking for a single swiss army knife tool that does every step. The one stop tool often does not exist. I hope that helps.
... View more
01-08-2013
03:17 PM
|
0
|
0
|
4296
|
|
POST
|
Hi, Hello, I recently created a model which automates convertion of XY tables from SQL Server to a point feature class. My job is to run this model on a daily basis, or everytime the SQL Server table is updated. My question is, is there a Geoprocessing Tool or which allows the model to run on its own after a pre-defined period i.e. 5 min, 10 min etc. Does anybody have an idea? Thanks in advance. Jun Since this only has to run on one machine, you can configure Windows Task Scheduler to run the script as frequently as you like. It should be located under All Programs/Accessories/System Tools in your Windows Start menu. You can supply your password to ensure it will run if your machine is not logged in, although you should disable any sleep or shut down policies on the machine if you want it to run fully unattended. Just export your model to a Python Script and set Task Scheduler to run it at the interval you want. You might want to add some arcpy logic to first verify if there are actual data changes present and customize the script to stop if nothing has changed, rather than complete the script when it is not needed. Task scheduler logs a start time and finish time of every task and a finish status of the script to indicate if it ran correctly or shut down unexpectedly. I use it for weekly updates, but supports most any schedule. Just be careful to fully troubleshoot your code if it is updating live accessed data, because long model processes may create more disruptions than they are worth and many scripts that work fine in a single user environment fail under those conditions.
... View more
12-29-2012
06:17 AM
|
0
|
0
|
656
|
|
POST
|
Yes, that sounds perfect. How do I run summarize attributes summary? Use the Dissolve tool under the Generalize group of the Data Management group to create multipart lines that will contain the lengths of the combined lines. The Summary Statistics tool under the Analysis geoprocessing tools can also be used to get a table output, but since you are wanting two case fields (Type and Line ID), it is hard to join back the results to the original lines, whereas the Dissolve tool will give a spatial output that can be joined back to the original lines using a Spatial Join.
... View more
12-25-2012
08:22 PM
|
0
|
0
|
804
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-24-2026 11:37 PM | |
| 1 | 03-24-2026 08:01 PM | |
| 7 | 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 |
a week ago
|