HOME | Avenue Bugs Report | HOME |
From ArcView Help: "Segmentation Violations are caused by attempts in the low-level ArcView code to access a memory address for which it doesn't have permission, such as accessing another process's memory space or trying to write to a read-only section of memory." According to an ESRI technical doc: (http://support.esri.com/kbase/KbDocument.asp?id=15322 ) the reason for Segmentation Violation when you are loading an extension might be: A. Conflicts with other extensions The bug However in some cases perfectly correct encrypted scripts that run on ArcView (English Windows) with no problems at all, are giving a fatal Segmentation Violation error when used on a Chinese or Japanese version of Windows. You can also get "Unrecognized object: XXX at YYY" when everything should run smoothly (and runs smoothly on an English version of Windows). The cause: According to my research the error is caused by the incorrect interpretation of the encrypted script by ArcView running on Chinese or Japanese versions of Windows The ArcView's encryption is a pretty simple one (see Bill Huber's web site for more info ), but it is not easy to identify where the problem is, especially if you don't have Windows versions on all possible languages. The solution: I don't have a solution for this problem, but couple of recommendations how to avoid it: 1. Do not use "{" or "}" symbols
without space before or after them 2. After encrypting your scripts check them with a text editor for the following string: ASCII pzjsz or Hexadecimal 70 7A 6A73 18 7A This string can possibly cause a Segmentation Violation error on Chinese or Japanese versions of Windows To avoid it you can simply add an empty or remarked line at the beginning of the script that will cause different encryption.
1. In some cases the Avenue requests involving intersect or select return incorrect results! |
Examples: Example1: Before Select (Image 1.) Example1: After select (Image 2.) Example2: Before select (Image 3.) Example2: After select (Image 4.) |
The Case We have two themes - a Polyline and a Polygon ( Images 1. & 3. ) If we use theme on theme selection (theme ==>Select By Theme) to select the features from the polyline theme that intersect the features from the polygon theme... we will get the following result ( Images 2. & 4. ) The same result we will get if we try to select the features from the polyline theme that are within distance of 1 meter from the features of the polygon theme Download the examples data to try it for yourself: The Affected Requests: Some of the requests that will give incorrect results.
The Cause: If a polygon has duplicate vertices (we get these often after using overlay functions as Clip, return difference etc.) the above mentioned requests might give incorrect results. ArcView overlay functions have improved from AV3.0 ==>AV3.1 ==>AV3.2
The eventual damage: If you want to select and delete all the records in a theme that intersect the features of a polygon theme, if the polygons have duplicate vertices you might delete features that do not have any intersections with the polygons. Try to clip the polyline theme from Example1 with the polygon theme from the same example. The result will be a polyline theme with 8 NULL polylines. The same result will produce the Clip functions of XTools and EditTools (up to version 3.0) The solution: The "Quick Clean" free function of EditTools 3.1 will clean all the duplicate vertices in the features of a Polygon or Polyline themes. It is recommended to use this function (or any other script for removing duplicate vertices) after you have applied some overlay requests on your theme. |
2. In some cases the request aPolyline.AsLine returns a Line with incorrect direction. AsLine Returns a line that approximates the shape of aPolyLine. Syntax Returns The request is supposed to return a Line that connects the Start and End points of the Polyline. It does so, however in some cases the direction of the newly created line is not correct, therefore the requests ReturnStart and ReturnEnd on the resulting Line will give incorrect results. |
Source: Single segment polylines with start point in the center of a circle |
|
Result: Lines result from the request aPolyline.AsLine The red lines indicate lines with incorrect direction |
|
The red area gives the angle range where the results will be
incorrect. Conclusion: If the angle of the line between Start and End point of a polyline is in the range 135 .. 315 degrees the resulting line will be with incorrect direction Note: 0.0 is North, 90.0 East, 180.0 South, etc |
A solution: Instead of: aLine = aPolyline.AsLine one can use: aLine = Line.Make(aPolyline.Along(0),aPolyline.Along(100)) which will create exactly the same Line, but with correct direction |
v = av.GetActiveDoc gl = v.GetGraphics gl.UnselectAll for each g in gl if (g.GetName = "tempEr") then g.Select end end gl.ClearSelected th = v.GetActiveThemes.Get(0) ft = th.GetFtab shf = ft.FindField("shape") if (ft.getShapeClass.GetClassName <> "Polyline") then msgbox.Info("The active theme must be Polyline theme","") return nil end sym1 = th.GetLegend.GetSymbols.Get(0) selr = v.ReturnUserRect th.SelectByRect (selr, #VTAB_SELTYPE_NEW) for each rec in ft.GetSelection pl = ft.ReturnValue(shf,rec) l1 = pl.AsLine l2 = Line.Make(pl.Along(0),pl.Along(100)) l1e = l1.ReturnEnd l2e = l2.ReturnEnd if(l1e.ReturnBuffered(l1.ReturnLength/50).Contains(l2e))then ylg = graphicShape.Make(l1) sym1.SetColor(Color.GetGreen) ylg.SetSymbol(sym1) ylg.SetName("tempEr") v.GetGraphics.Add(ylg) else nlg = graphicShape.Make(l1) sym1.SetColor(Color.GetRed) nlg.SetSymbol(sym1) nlg.SetName("tempEr") v.GetGraphics.Add(nlg) end end ft.GetSelection.ClearAll ft.UpdateSelection |
This is a sample scipt that will show the problem on your
data. How to use it:
|
3. QueryPointDistance request reports sometimes incorrect side of the polyline request reports sometimes incorrect side of the polyline: From
ArcView HELP The BUG. In a polyline with angle between two segments smaller than 90 degrees QueryPointDistance reports incorrect side of the polyline for points in certain areas. |
If we make query for a point (thePoint)
in the red areas shown on the first image theDistance = 0 theDistance will be incorrectly reported with a POSITIVE value The different areas here are defined by the extensions of both segments and the lines perpendicular to each segment. Most probably the cause for the incorrect results is that QueryPointDistance actually returns the side of the extension of the closest segment to thePoint. The LEFT side of the polyline is always reported correctly If we flip the polyline and evaluate again the results will be different. |
Sample script that reports the results from QueryPointDistance for a user defined point.
v = av.GetActiveDoc th = v.GetActivethemes.Get(0) ft = th.GetFtab shf = ft.FindField("shape") if(ft.GetSelection.Count <> 1) then msgbox.Error("One and Only one"+nl+"polyline should be selected","") return nil end pl = ft.ReturnValue(shf,ft.GetSelection.GetNextSet(-1)) p = v.GetDisplay.ReturnUserPoint dist = 0 pl.QueryPointDistance (p, dist) if (dist < 0) then side = "RIGHT" elseif (dist > 0) then side = "LEFT" else msgbox.info("The point is on the line","") return nil end msgbox.info(side+nl+dist.AsString,"") |
How to use it:
|
For any comments and enquiries contact: webmaster@ian-ko.com
Esri and all Esri products mentioned are trademarks of Environmental Systems Research
Institute, Inc.
Copyright: Ianko Tchoukanski