10-10-2018 11:54 AM
I am trying to find the intersection points between a line and the buffer zone around another line. At the moment I am just getting the one intersection between the two lines and not that of the buffer zone.
The process I follow is this: First create a OriginatingPipe (OP) and assign values for the OP.Table and the OP.Filter. Then take OP and feed it into a Merge Pipe (objMP) and create a FunctionalAttribute (objFA) and append the objFA to the objMP. I then take the objMP.OutputRecordset and use that as the InputRecordset for a new BufferPipe (objBuffer). We assign values to all the various properties of the objBuffer. I then pass the objBuffer.OutputRecordset to the Spatial Intersection Pipe with the recordset and GeometryFieldName from some other feature. Using the objBuffer.OutputRecordset I can create a legend entry that displays the buffer correctly around the line but the Spatial Intersection Pipe returns the intersections between the line and some other feature instead of the edges of the buffer zone.
Please find attached a code snippet below. What am I doing wrong?
Dim OP As PClient.OriginatingPipe Connection.CreateOriginatingPipe(OP) OP.Table = "PathLines" OP.Filter = "" objMP = CreateObject("GeoMedia.MergePipe") MergeFieldNames(0) = "Geometry" objMP.InputRecordset = OP.OutputRecordset objMP.MergeFieldNames = MergeFieldNames objFA = CreateObject("GeoMedia.FunctionalAttribute") objFA.Expression = " Merge (Geometry)" objFA.FieldName = "Geometry" objMP.OutputFunctionalAttributes.Append(objFA) rs = objMP.OutputRecordset objBuffer = CreateObject("GeoMedia.BufferPipe") With objBuffer .InputGeometryFieldName = "Geometry" .InputRecordset = rs .InputDistanceUnit = GM_UnitConstants.igDistanceMeter .BufferType = "1" .DistanceType = "1" .InputDistance = bufferZone.Distance .OutputGeometryFieldName = bufferZone.GeomName .OutputStatusFieldName = "Status" End With BuferRecordset = objBuffer.OutputRecordset 'Transform Recordset to different coordinate system GUID using CSSTransformPipe Dim xflnRs As PClient.GRecordset = TransformRstoGuid(Intergraph.CoordSystems.Interop.CoordSystemMgr, BuferRecordset, "Geometry") Dim sqp As PPipe.SpatialIntersectionPipe 'SpatialQueryPipe sqp = CreateObject("Geomedia.SpatialIntersectionPipe") sqp.LeftRecordset = FeatureOutputRecordset sqp.RightRecordset = xflnRs sqp.LeftGeometryFieldName = bathyGeomFldName sqp.RightGeometryFieldName = "Geometry" sqp.SpatialOperator = 2 sqp.OutputGeometryFieldName = "PointFromCross" sqp.OutputStatusFieldName = "SIP_Status" Return sqp.OutputRecordset
Solved! Go to Solution.
10-10-2018 01:58 PM
Your result is a little strange ...
I guess one problem is in line 16 and 17. I'm wondering there is no error when you run this code.
You merge the geometry field "Geometry" and the output field calls "Geometry" too. That must be invalid ...
What is the code of FeatureOutputRecordset or where it come from?
10-11-2018 03:49 PM
Thank you for your reply and for your help!
I’m not sure why merging the geometry field “Geometry” and calling the fieldname “Geometry” would be invalid. When we proceed forward with this to create a buffer zone and display it, the buffer zone displays correctly using the created BufferPipe output recordset. So we do not get an error at all when it passes through this code. Should the Functional Attribute FieldName be unique? Could there be some conflict here that coincidentally works for creating the BufferPipe Output recordset and using it to display the bufferzone but causes it to return an strange result for the SpatialIntersectionPipe (in this case the path or geometry used to create the buffer zone instead of the buffer zone itself)?
Also the FeatureOutputRecordset comes from a database and is has a geometry field name “GDO_Geometry”. The particular feature we are looking at contains as a test run 40 records and each one is essentially a polyline geometry.
10-11-2018 04:17 PM - edited 10-11-2018 04:20 PM
Maybe your right, there is no problem with the double use of the name "Geometry".
Second try: In line 53 write sqp.RightGeometryFieldName = bufferZone.GeomName instead of sqp.RightGeometryFieldName = "Geometry".
10-11-2018 04:23 PM
With sqp.RightGeometryFieldName = "Geometry" you take the origin geometry field of the polyline. So it's exactly what you get - but not what you want ...
10-11-2018 11:48 AM
Awesome, that worked great!! Like you said we were using the wrong field so we got what we asked for but not what we wanted.
Many thanks for your help!!