Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
New Contributor
Posts: 3
Registered: ‎11-02-2017
Accepted Solution

How to find intersection point of line and a buffer zone

Hello,

 

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?

 

Many thanks

 

 

    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

 

Regular Contributor
Posts: 174
Registered: ‎05-25-2016

Re: How to find intersection point of line and a buffer zone

Hi adrianj

 

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?

 

Best regards,

hesrah

New Contributor
Posts: 3
Registered: ‎11-02-2017

Re: How to find intersection point of line and a buffer zone

Hi Hesrah,

 

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.

 

Many thanks


Adrian

 

Regular Contributor
Posts: 174
Registered: ‎05-25-2016

Re: How to find intersection point of line and a buffer zone

[ Edited ]

Hi Adrian

 

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".

 

Best regards,

hesrah

Regular Contributor
Posts: 174
Registered: ‎05-25-2016

Re: How to find intersection point of line and a buffer zone

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 ...

New Contributor
Posts: 3
Registered: ‎11-02-2017

Re: How to find intersection point of line and a buffer zone

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!!

 

Adrian

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.