If you look at the syntax for create Polyline, I think you need to specify how 
many segments it should contain:

Create Pline 
        [  Into  { Window   window_id  |  Variable   var_name } ] 
                [ Multiple num_sections ]
                num_points
         ( x1,  y1)  ( x2,  y2)  [ ... ]
        
If is the Multiple num_sections I'm refering to.

But, I think this was added in a later version of MapInfo, and it is not 
available in MB 4.5
So I guess you have to create only single segment polylines, and then combine 
them everytime you shift to next segment

Something like this:

Do While (...)
        '**Here you read the segment#, point# and the coordinates

        If nCurSegm <> nNextSegm Then
                If nNumSegment = 0 Then
                        
                ElseIf nNumSegment = 1 then
                        oMultiSegment = oSingleSegment
                else
                        oMultiSegment = Combine(oMultiSegment, oSingleSegment)
                End if

                Create PLine Into Variable TempPolyLine 0                       

                nNumSegment = nNumSegment + 1
        End if

        '**Here you add the nodes
Loop

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: David Baker [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 17, 2005 9:45 AM
To: [email protected]
Subject: MI-L Mapbasic: Creating polylines with multiple sections


I have a MapBasic 4.5 command:

        Alter Object TempPolyLine Node Add Position PolylineSections, 
ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1 (PointLong, PointLat)

TempPolyLine is my polyline which was originally created with:

        Create Pline Into Variable TempPolyLine 0

PolylineSections is a "SmallInt value (one or larger), identifying one section 
from a 
polyline object".

ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1     is of course the number of 
existing nodes + 1, to refer to my new node number that I am about to create.

PointLat & PointLong are my Latitude & Longitude of the node I want to create.



I am reading in polylines from another file format (Garmin .mp "polish" 
format). These 
polylines have multiple sections, so I want to create the MapInfo polylines 
with the same 
multiple sections.

All works well while PolylineSections is 1, but as soon as I try to add the 
first node after 
changing PolylineSections to 2, I get a MapBasic error:

        "Alter Object Node Add failure"

Am I trying to do this the wrong way? Can I just keep adding points & the new 
section 
will be created automatically, or am I missing some command to inform MapBasic 
that I 
am adding in a new section?

Thanks,

Dave




---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To 
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14872



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14874

Reply via email to