|
POST
|
The AddIn DockableWindow has no properties for adjusting the frame location beyond the initial position listed in the XML file that first creates the object. The AddIn DockableWindow fires Layout and Resize events that I can detect, but I cannot seem to intercept them and modify the behavior. I want to access the kinds of properties available in the IWindowPosition (ESRI.ArcGIS.Framework.IWindowPosition) for an AddIn IDockableWindow (ESRI.ArcGIS.Desktop.AddIns.DockableWindow) after it is created, but can't find any way to cast it to that object or one like it. IWindowPosition can cast an object of IDockableWindow (ESRI.ArcGIS.Framework.IDockableWindow), which seems like it should be related, but I cannot find any inheritance commonality. Is there a way to access the AddIn DockableWindow's position properties after it has been created when the user triggers a Layout or Resize event? If not I think I have to go with a standard Windows Form to avoid users hiding my Form controls and not knowing what to do.
... View more
11-02-2011
02:17 PM
|
0
|
1
|
890
|
|
POST
|
I am indeed interested in such a tool since (in my opinion) linear referencing for large-scale real world conditions is pretty much worthless without taking into account elevation. I can see the point of calibrating a route with observations (time consuming), but for regional analysis it would be great to merge the M and Z functionality. Let me know if you want someone to test your Add-In because I have a State-wide layer and I would like to see how it changes when Z-values are considered. Jeffrey: Thank you for showing an interest in this. If you look at some of my other posts in the ArcObjects for All Languages forum you will see that I have begun creating an Add-In for ArcGIS 10. I have figured out how to deal with polylines that contain curved segments (circular, bezier, ellipise). I have also incorporated options to allow a user to assign an offset beginning measure and a measure multiplier for unit conversion. Where I am now struggling is with standardizing units of length. The code only works at the moment for Projected Coordinate Systems with Linear units that are the all same for X/Y and Z. Standarizing Projected Coordinate Systems with mixed units should not be that hard, since all units are Linear and referenced to meters in the Spatial Reference. So if your data has a Projected Coordinate System I should have working code fairly soon that should also be able to project measure offsets across multi-part polyline gaps as an option. However, I have not figured out how to standarize mixed Angular and Linear Geographic Coordinate Systems to a single unit of length measures. Until I can figure out all of the unit standardizations subroutines involved the base code and projections of 3D straight line measure values across gaps will not work for Geographic Coordinate Systems. I just have not had much input on the forums and not a lot of time to reasearch that just yet. So let me know if the code I have now or soon for Projected Coordinate Systems would work for you or if you need the code to work with a Geographic Coordinate System before you could apply it.
... View more
11-02-2011
10:06 AM
|
0
|
0
|
2878
|
|
POST
|
Check out the code of this tool designed to detect and delete holes in Polygons. It will probably give you some ideas on how to fix your problem. http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=C4E10FE5-1422-2418-A06D-33952BB8D1D7
... View more
11-01-2011
08:35 PM
|
0
|
0
|
2871
|
|
POST
|
Been searching but probably right under my nose. I need to label the corners or vertices of a polygon with the map projected coordinates. I can see where you can specify the coords and create labels but this means I have had to zoom in to each corner and do it manually. I know, stupid. Should I create a point feature layer or what. cheers If you have ArcInfo you can use the Feature Vertices to Point tool in the Data Management Toolset. If you do not have that, perhaps the tools at http://www.ian-ko.com/ can be of use for your problem, or else a custom python script perhaps adapted from the code at http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=C4E10FE5-1422-2418-A06D-33952BB8D1D7 Hope this helps.
... View more
11-01-2011
08:26 PM
|
0
|
0
|
3923
|
|
POST
|
Hello, Does anyone know if it is possible to mark a position along a line with a marker symbol contained in a custom style? How do I find the custom marker symbol and assign it to the point location along the line? G Are you meaning you want nodes to show a marker or are you meaning you want a point that snaps to the line at a specific position that may be anywhere you want along the line. Nodes (other than the ends of the line) have to be exported or extracted as points to have a marker. Linear Referencing works well for the second option. Marker symbols can be found in the predefined groups or built from fonts, pictures, etc. So that also depends on what marker you want. Representations are another option. What does the point represent? Is the marker a permanent feature or just a graphic inside the map? So please clarify what you are wanting to do. What language do you want this programmed in and how do you envision the program interacting with the user. Anything ArcMap can do can be done in ArcObjects if you can break down the interfaces needed, but not all processes are easily devined.
... View more
10-31-2011
08:52 PM
|
0
|
0
|
1359
|
|
POST
|
I found this thread on working with vertical polylines and it says: "The ArcGIS geometry object model supports parametric curve segments, such as circular arcs and Bezier curves, but the behavior of these segments is not defined in 3D. However, you can use them in 3D polylines if you simply want to use their Z values as attributes and otherwise treat the segment as 2D." This explains why the ICurve3D interface throws an error and usually crashes ArcMap when I attempt to use it on curved polylines. This also means that when the link above says that "Two-dimensional (2D) relational operators have been extended to deal reasonably with such polylines.", the extensions only work with linear 3D polylines and not nonlinear 3D polylines. So Densifying the curved 3D polylines into linear 3D polylines is required if the objects need to use the extended relational operators for selections that take the 3D geometry into account, but if preserving the curve is more important and being limited to 2D relational operations is acceptable, than the code above would work.
... View more
10-30-2011
03:19 PM
|
0
|
0
|
688
|
|
POST
|
Affter reading some of the help on working with the Spatial Reference I can see I am opening a can of worms in trying to accomodate all possible coordinate systems. But I am looking for a some education on the subject. I kind of understand that Projected Coordinate Systems (PCSs) have Linear Units and seem like they can be combined with Z Linear Units and outputted to the standard Horizontal Linear unit without a lot of difficulty. There are some code examples for extracting parameters of PCSs. But I am not sure what to do with the Angular units of a Geographic Coordinate System (GCSs) to combine them with Z Linear Unit values and output to a standard length unit value. Also it is not clear whether the same parameter examples for PCSs apply to GCSs. I know there are people on the forum who have looked into this far more than I have and I can definitely use some guidance and help in breaking it down. Links to helpful code samples (preferably in C# or VB .Net) would also be appreciated. It looks like Melita Kennedy at Esri gives most of the help on Coodinate Systems, so I hope she will pick up on this post to help me start a crash course on the subject.
... View more
10-30-2011
02:41 PM
|
0
|
0
|
880
|
|
POST
|
Can someone tell me why these two calcs don't work? the "speed" one completes, but doesn't do anything. The one that calculates distance based on shapelength errors. Not sure if you can script calculate length based on shapelength in version 10.
# Description: Calculates speed and distance
#arcmap 10
# Import system modules
import arcpy
from arcpy import env
# Get user-supplied input
InputFC = arcpy.GetParameterAsText(0)
try:
# Calculate Speed based on time and distance
arcpy.CalculateField_management(InputFC, "Speed", "[Time] / [Distance]", "VB")
except:
errMsg = arcpy.GetMessages(2)
arcpy.AddError("Unexpected error: cannot calculate Speed" + errMsg)
try:
# Calculate Speed based on time and distance
arcpy.CalculateField_management(InputFC, "Distance", "float(!SHAPE.LENGTH@kilometers)", "PYTHON")
except:
errMsg = arcpy.GetMessages(2)
arcpy.AddError("Unexpected error: cannot calculate Distance" + errMsg) The first error I will point out is that you are missing an exclamation point on your second calculation. It should be: arcpy.CalculateField_management(InputFC, "Distance", "float(!SHAPE.LENGTH@kilometers!)", "PYTHON") For the other calculation, if Distance is 0 or Null, the calculation will fail (division by 0 or Null is not allowed and the geoprocessor skips over those records). I would think you need to reverse the calculation order, since you should want the Distance assigned before you attempt to calculate Speed. Using the Length field directly is touchy especially if your data is stored in SDE, but it sometimes works. However, if you apply the fixes above the calculations you have should work.
... View more
10-30-2011
12:34 PM
|
0
|
0
|
930
|
|
POST
|
I am wanting to enhance the VB .Net code I am developing to assign 3D length M values to a polyline according to whatever SpatialReference a user has for Horizontal and Vertical Datum. Where a gap exists between two parts of a multi-part polyline, I want to be able to optionally calculate the 3D straight line length of the gap and add it to the measures. Basically I am trying to emulate the behavior of the Create Route tool (except that the Route lines are already assumed to be assembled and oriented). In the data I normally use my SpatialReference is projected and the units for horizontal length and vertical length are the same, which makes the calculations fairly easy. However, that configuration is not the case for everyone who might want to use the code and I would like the code to be able to handle that without requiring customization to each specific configuration. So my primary issue is: How do I extract the Horizontal and Vertical units from the feature class' SpatialReference so I can standardize the output to match the horizontal length units reported by the feature class? (Assumes a measure factor of 1.) Related issues: What approach should I adopt if the Vertical units are Unknown (request user input?, asssume same units as horizontal length units?, assume meters?, etc.)? What approach should I take for segments that have nodes with NaN values for Z (provide a user specified option, read all surrounding segments until I find real values and interpolate or if one end has no real values hold the value of the other end?)? Should I only use linear 3D length measures or should I optionally allow geodeesic length measures? If I accomdate both, what is a reasonable approach to get geodesic lengths, given that I am not a Surveyor or mathematician? Thanks for any input.
... View more
10-30-2011
07:32 AM
|
0
|
3
|
2818
|
|
POST
|
There is also a Densify Method on IGeometryBridge, IGeometryService, IPolycurve and ISegment. This should convert a curve shape to an array of points. See the second post in the thread for a method that will modify either Z or M values of a nonlinear polyine without destrying the feature's curved segments (written for VB .NET, but similar to VBA if you add the Set keyword). The same principles and coding concepts apply to manipulating Z and M values in nonlinear polygons.
... View more
10-29-2011
09:47 AM
|
0
|
0
|
1501
|
|
POST
|
For those who are interested I got the code to work. I modified it based on the example l for How to modify a specific Segment of a polyline. The key was to use the original SegmentCollection's SegmentsChanged method and to pass the original segmentCollection back to the feature's shape. Below is the main loop that worked. I have tested this code with a polyline that had one part with one curved segment and another that had two parts with one curved segment each. It worked for both features. The concepts used in this code should apply to both polylines and polygons. ' Main loop
Do While Not pFeat Is Nothing
pPolyline = New Polyline
pPolyline.SpatialReference = pFeat.Shape.SpatialReference ' Make sure Polyline has Spatial Reference
pPolyline = pFeat.Shape ' Assign geometry to Polyline
pSegColl = pPolyline ' Assign polyliine geometry to a SegmentCollection
pSegColl.HasNonLinearSegments(Nonlinear) ' Determine if any segments are nonlinear
If Nonlinear Then
' One or more segments is nonlinear. Code below preserves curved segments while changing Z or M values.
SegCount = pSegColl.SegmentCount
distAlong = 0
For j = 0 To SegCount - 1
pSegment = pSegColl.Segment(j)
pInPoint = New Point
pInPoint.SpatialReference = pFeat.Shape.SpatialReference
pInPoint = pSegment.FromPoint
pInPoint.M = distAlong ' Update either Z or M value here
pSegment.FromPoint = pInPoint ' Update Segment's FromPoint so it has new Z or M value
pSegColl.SegmentsChanged() Use SegmentsChanges method to update collection
pInPoint = Nothing ' Clean up Point Object
distAlong = Math.Sqrt(pSegment.Length ^ 2 + (pSegment.FromPoint.Z - pSegment.ToPoint.Z) ^ 2) + distAlong
pInPoint = New Point
pInPoint.SpatialReference = pFeat.Shape.SpatialReference
pInPoint = pSegment.ToPoint
pInPoint.M = distAlong ' Update either Z or M value here
pSegment.ToPoint = pInPoint ' Update Segment's ToPoint so it has new Z or M value
pSegColl.SegmentsChanged() Use SegmentsChanges method to update collection
pInPoint = Nothing ' Clean up Point Object
' Uncomment line below to see changes to curved segments
' MsgBox("Segment M Values are: From - " & pSegColl.Segment(j).FromPoint.M & ", To - " & pSegColl.Segment(j).ToPoint.M & " Geometrytype is " & pSegColl.Segment(j).GeometryType)
Next j
pFeat.Shape = pSegColl
pFCursor.UpdateFeature(pFeat) ' Update the cursor
Else
' Segments are all linear. Code is not shown but it involved an I3DCuve object which won't operate on curved polylines.
End If
pFeat = pFCursor.NextFeature
pPolyline = Nothing 'Clean up Polyline Object
i = i + 1 ' Counter for features processed
If i Mod 1000 = 0 Then ' flush edits after every 1,000 features
pFCursor.Flush()
End If
Loop If anyone knows about better clean up practices for .NET please let me know. Now I need to add code that will check which part each segment is in to optionally calculate a gap dstance for my M values (the default behavior of the code is to ignore gaps between parts). I hope this helps others who want to build custom code for manipulating Z or M values on nonlinear polylines or polygons.
... View more
10-29-2011
09:32 AM
|
0
|
0
|
688
|
|
POST
|
I am trying to modify Z or M values of a polyline that has nonlinear segments, such as circular arcs, eliptical arcs, and bezier curves, without converting the line to linear segments. Densifying the curve into line segments is not an option. My code below seems to work until I try to update the feature shape with the modified geometry. At that point ArcMap crashes (I know bad error handling, but an error clearly is occurring the first time that code section runs and I need to overcome it). The feature I am trying to modify is an ellipse with one part and one segment, just to see if I can get this to work at all. I'll worry about multiple parts and segments later. Any ideas on how to properly use the ISegmentCollection or possibly the IGeometryCollection objects to achieve what I want? There is very little documentation of these objects. ' Assume I already have a valid Polyline Featurelayer that is Z and M Aware called pFLayer
Dim pFC As ESRI.ArcGIS.geodatabase.IFeatureClass
pFC = pFLayer.FeatureClass ' Get FeatureClass of FeatureLayer
Dim pFCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
pFCursor = pFC.Update(Nothing, False) ' Create an UpdateCursor on FeatureClass
Dim pFeat As ESRI.ArcGIS.Geodatabase.IFeature
pFeat = pFCursor.NextFeature ' Get First Feature
Dim pPolyline As IPolyline = pFeat.ShapeCopy
Dim pSegColl As ESRI.ArcGIS.Geometry.ISegmentCollection
Dim Nonlinear As Boolean = False
Dim SegCount As Long = 0
Dim pInPoint As IPoint ' Current Point to process
Dim distAlong As Double ' 3D Distance along the curve
Dim j As Long = 0
Dim pSegment As ISegment
Dim NewSegments As ESRI.ArcGIS.Geometry.ISegmentCollection = New Polyline
Do While Not pFeat Is Nothing
pPolyline = New Polyline
pPolyline.SpatialReference = pFeat.Shape.SpatialReference ' Make sure Polyline has Spatial Reference
pPolyline = pFeat.Shape ' Assign geometry to Polyline
pSegColl = pPolyline
pSegColl.HasNonLinearSegments(Nonlinear)
If Not Nonlinear Then
' All Segments are linear and code works without a problem so it is not included
Else
' One or more segments of the polyline is Nonlinear
SegCount = pSegColl.SegmentCount
NewSegments = New Polyline
distAlong = 0
For j = 0 To SegCount - 1 ' read all segments
pSegment = pSegColl.Segment(j)
pInPoint = New Point
pInPoint.SpatialReference = pFeat.Shape.SpatialReference
pInPoint = pSegment.FromPoint
pInPoint.M = distAlong
pSegment.FromPoint = pInPoint
distAlong = Math.Sqrt(pSegment.Length ^ 2 + (pSegment.FromPoint.Z - pSegment.ToPoint.Z) ^ 2) + distAlong
pInPoint = New Point
pInPoint.SpatialReference = pFeat.Shape.SpatialReference
pInPoint = pSegment.ToPoint
pInPoint.M = distAlong
pSegment.ToPoint = pInPoint ' Modify ToPoint to add M value
MsgBox("Segment To Point M Value is " & pSegment.ToPoint.M & " pInPoint M Value is " & pInPoint.M & " and Distance Along is " & distAlong) ' Verify everything updated
NewSegments.AddSegment(pSegment) ' Append segment to another segmentCollection
Next j
pPolyline.SpatialReference = pFeat.Shape.SpatialReference
pPolyline = CType(NewSegments, ESRI.ArcGIS.Geometry.Polyline)
If pPolyline Is Nothing Then
MsgBox("Bad Segments to Polyline")
Else
MsgBox("To Point M Value is " & NewSegments.Segment(0).ToPoint.M & " Geometrytype is " & NewSegments.Segment(0).GeometryType) ' Verify that NewSegment is a curve GeometryType still. It says it is an Ellipse Geometry with updated M values and everything seems to be working.
End If
pFeat.Shape = NewSegments ' Code causes ArcMap to crash here on the first nonlinear feature. Also tried "pFeat.Shape = pPolyline" with same result
pFCursor.UpdateFeature(pFeat) ' Update the cursor
End If
pFeat = pFCursor.NextFeature
pPolyline = Nothing
Loop
... View more
10-28-2011
10:28 PM
|
0
|
2
|
1245
|
|
POST
|
I have been rewriting my code as an Add-In and testing the behavior of Linear Referencing on Polylines that are Z and M aware. I am pleased to say that Points and Lines exported from Route Event layers preserved the Z information at the point and along the line, and automatically interpolates Z values for those points or line end points that occur between vertices. This even occurs on polylines with true curved segments and vertical only polylines. Based on my testing so far, it appears that an event table could fairly easily be created that could produce a segmented 3D copy of the 3D line broken into equal parts as measured by 3D length for lines that have the M values calculated based on the 3D length of the line. This includes segentation of vertical only polylines. After 3D Length Measure values are assigned the user can look at the Sketch of the line and easily determine the 3D length between any two vertices (just subtract the lower M value from the higher M value to get the 3D length between the points). I tested the code on a multi-part line with a gap and by default the code adds no distance between the vertices on either side of the gap. I think I know how to operate on the parts to interpolate a straight line 3D distance between polyline parts, so I should be able to add that as an option. The code in my post does not handle lines with true curved segments and throws an error for such lines. I believe I have figured out a way to approximate the 3D length values for true curves without altering the curve's geometry or using the I3DCurve interface, provided I assume that the elevation change between the endpoints of the curved segment is linearly distributed over the curve and the curve is not trying to follow an elevation surface. So a curve with equal elevations at each end will just have M values based on the 2D curve length of the segment, but if there is an elevation change at the ends of the curve, I will treat the segment curve length as though it was a straight 2D line changing in elevation and use the formula SQRT([curve_length)^2 + (z1 - z2)^2]). I think this is how the Route Event layer handles its interpolation of Z values on true curves, but I may be wrong. I still have to do some tests of a new subroutine that uses this formula and correctly applies Spatial Reference units for XY and Z, but I expect that the distortion in measures using this method will be no more than what results from Densifying a curve into small linear segments. (Someone with more math skills than me is welcome to point out any mathimatical logic flaws with the above formula, but if the errors it produces are reasonably low it may be good enough for most uses). So is anybody interested enough to comment on this? Please let me know.
... View more
10-28-2011
10:47 AM
|
0
|
0
|
2878
|
|
POST
|
In the Desktop forum this thread has code I have written to assign 3D Lengths to the M values of polylines that are both Z and M aware. The code works but it is very skelatal and basic at this point. I am looking for others interested in testing the code and offering comments on what user options should be added to the code. For example, I could rewrite the code to work on a Feature Selection, or allow a user specified offset to the beginning measure, or give options for how gaps will be handled on multi-part routes. Also the code needs a user interface. I was thinking about an Add-In or if someone could help me do the basic function in Python it could be a geoprocessing script tool. Please lend me your thoughts on how best to expand this functionality and more fully integrate the complete spectrum of a Route feature's geometry for analysis and real world uses.
... View more
10-27-2011
04:26 PM
|
0
|
10
|
5294
|
|
POST
|
I have been creating transportation sign face files in Illustrator and exporting them to EMF format for use in layers depicting transportation signs. I have many Federal and California MUTCD signs that cannot be created using the MUTCD fonts in ArcMap. The draftmanship is not perfect but it is very decent, and since in most cases the signs are displayed very small to avoid overlapping each other on a map, they meet my needs for conveying what the sign looks like. Whereever possible I try to use Spec diagrams of the signs as a background for element placement and size accuracy. Since I probably am not the only person who would use such files, I wanted to share them with the community. However, I was not sure where to share them. They do not seem like Samples and Utilities, Data Models, or Galleries, so I am not clear where it is best to load them. Also, should I post the individual EMF files or create a style file and post that? I have zipped up 20 signs as an example of my work. I actually have 200 signs created so far and growing. Is anybody interested in this?
... View more
10-26-2011
09:11 AM
|
1
|
3
|
4355
|
| 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
|