# Other Software and Data

View Only

## How to know if a MultiCurve objets has more than one node in the same location? #### Alejandro Hernandez28 days ago #### Peter Horsbøll Møller28 days ago #### Alejandro Hernandez27 days ago #### Liz Walker26 days ago #### Alejandro Hernandez25 days ago #### Liz Walker23 days ago #### Alejandro Hernandez23 days ago • #### 1.  How to know if a MultiCurve objets has more than one node in the same location?

Posted 28 days ago
Hi,

I can solve this is anyone shows me how to extract nodes coordinates of each node

Thank you!

------------------------------
Alejandro Hernandez
Information Technology & Services
ITS SA (GBD)
Buenos Aires
------------------------------

• #### 2.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 28 days ago
Edited by Peter Horsbøll Møller 28 days ago

Hi Alejandro,

What software are you using? MapInfo Pro or MapXtreme?

If you are using MapBasic, I'd recommend that you post your questions in the MapInfo Pro Developers User Group instead.

You will have more people looking at your question that know about developing with MapInfo Pro using MapBasic, .NET or even Python.

------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Pitney Bowes Software & Data
------------------------------

• #### 3.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 27 days ago
Hi Peter

I am using MapXtreme 8.1

Is this the correct forum?

Thank you

------------------------------
Alejandro Hernandez
Information Technology & Services
ITS SA (GBD)
Buenos Aires
------------------------------

• #### 4.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 26 days ago
Hi Alejandro,

To extract the points you need to loop through each Curve within the  MultiCurve, then within each curve loop through each segment which is actually a line string which will give you  start and end points

e.g.

```    MultiCurve myMultiCurve

foreach (var curve in myMultiCurve )
{
foreach (var segment in curve)
{
var x = segment.StartPoint.x;
var y = segment.StartPoint.y;
}
}```

------------------------------
Liz Walker
------------------------------

• #### 5.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 25 days ago
Hi Liz

Thank you but is not working.
Please can you tell me what's wrong?

I have points in a database an want to create the polyline object  (polylne is in MapInfo)

'Geometry construction

lo_MIDPoints(0) = New MapInfo.Geometry.DPoint(1, 100)
lo_MIDPoints(1) = New MapInfo.Geometry.DPoint(2, 200)
lo_MIDPoints(2) = New MapInfo.Geometry.DPoint(3, 300)

lo_MI_Geometry = New MapInfo.Geometry.MultiCurve(MapControl1.Map.GetDisplayCoordSys, CurveSegmentType.Linear, lo_MIDPoints,

First question: The multiCurve geometry is the correct geometry to construct the "polyline:"?

--------------------------------------------------------------------------------------

'Loop to know coordinate of each node

For Each oCurve As Curve In lo_MI_Geometry
For Each oSegment As LineString In oCurve
'oSegment.StartPoint
'oSegment.EndPoint
Next
Next

Why can' get each segment and their coordinates?  In this case return me only one segment when in fact I have 3 points.!  So I shoud get 2 segments right?
Segment 1, from 1,100 to 2,200
Segment 2, from 2,200 to 3,300

Thank you!

------------------------------
Alejandro Hernandez
Information Technology & Services
ITS SA (GBD)
Buenos Aires
------------------------------

• #### 6.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 23 days ago
Hi Alejandro,

Re Question 1:
If you want to create a polygon then MultiPolygon is the geometry type to use rather than MuiltiCurve:-

```lo_MIDPoints(0) = New MapInfo.Geometry.DPoint(1, 100)
lo_MIDPoints(1) = New MapInfo.Geometry.DPoint(2, 200)
lo_MIDPoints(2) = New MapInfo.Geometry.DPoint(3, 300)
lo_MIDPoints(3) = lo_MIDPoints(0)

lo_MI_Geometry = New MapInfo.Geometry.MultiPolygon(MapControl1.Map.GetDisplayCoordSys, CurveSegmentType.Linear, lo_MIDPoints)```

To create a closed geometry you need to have the first point equal to the last.

Re: Question 2
You only have 2 segments in your example as the multiCurve is not a closed geometry so the number of segments will be one less than the number of points.

------------------------------
Liz Walker
------------------------------

• #### 7.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 23 days ago
Hi Liz

Yes, I have only two segments, but how can I know the coordinates of each segment?

The code I wrote does not return correctly each coordinates.

Where is the problem?

Thank you!

------------------------------
Alejandro Hernandez
Information Technology & Services
ITS SA (GBD)
Buenos Aires
------------------------------

• #### 8.  RE: How to know if a MultiCurve objets has more than one node in the same location?

Posted 22 days ago
Sorry I missed a level out on my first explanation here is the c# code

``` DPoint point1 = new DPoint(1, 100);
DPoint point2 = new DPoint(2, 200);
DPoint point3 = new DPoint(3, 300);

var points = new List<DPoint>() {point1, point2, point3, point1};

CoordSys coordsys = Session.Current.CoordSysFactory.CreateCoordSys("EPSG:27700");

var multiCurve = new MultiCurve(coordsys, CurveSegmentType.Linear, points.ToArray());

foreach (var curve in multiCurve)
{
foreach (var segment in curve)
{
if(segment is LineString line)

foreach (var point in line)
{
Debug.Print(\$"{point.x} {point.y} ");
}
}
}​```
which produces the output

```1 100
2 200
3 300
1 100 ​```

------------------------------
Liz Walker
------------------------------