MI Nodes in Polylines

2000-06-08 Thread Possberg, Hendrik (Fa. Microm)

Hello to all,

I have a question concerning nodes in Polylines.


1. Is it possible to get the number  of nodes in a Polyline?

2. in the next step I would like to get the coordinates for all the nodes which are 
building a polyline.

Due to the  amount of polylines it´s not possible to do this manually.

I know how to get the min and max Coordinates of a Polyline, but this is not the 
problem. 

I have knowledge of MapBasic.   

   Any suggestions would be helpful.

   Thanks to all for your help. 

   Hendrik Poßberg





RE: MI Nodes in Polylines

2000-06-08 Thread Scott Hall
Title: RE: MI Nodes in Polylines





 1. Is it possible to get the number of nodes in a Polyline?


Getting the number of nodes for a pline is found through ObjectInfo.


Dim bObject As Object
Dim nNumNodes As Integer


bObject = PolylineTable.Obj


nNumNodes = ObjectInfo(bObject, OBJ_INFO_NPNTS)


 2. in the next step I would like to get the coordinates for all the nodes which are  building a polyline.


Use the ObjectNodeX and ObjectNodeY commands to grab the x and y coordinates of the nodes. You can use a counter to loop thru the polyline node by node. It would also be helpful to check for plineness - ObjectInfo(bObject, OBJ_INFO_TYPE) - before the loop as I have found MapBasic to be a little tipsy with ObjectNode and a regular old line.

Dim Xcoord As Float
Dim Ycoord As Float


For nCntr = 1 To nNumNodes
 Xcoord = ObjectNodeX(bObject, 1, nCntr)
 Ycoord = ObjectNodeY(bObject, 1, nCntr)
Next  





RE: MI Nodes in Polylines

2000-06-08 Thread Jacques Paris
Title: RE: MI Nodes in Polylines



You 
cannot use 
nNumNodes = ObjectInfo(bObject, 
OBJ_INFO_NPNTS) 
as the 
upper boundary for the loop where you extarct the nodes x and y. The 
statement
Xcoord = ObjectNodeX(bObject,1, nCntr)
will 
create an error if a polyline contains more than one segment and nCntr becomes 
 than the number of nodes in segment one. You have to create a double loop 
to "read" the nodes segment by segment. See corrections in original 
message.

Jacques 
Parise-mail 
alternate [EMAIL PROTECTED] 
[EMAIL PROTECTED]paris PC Consult (mainly MapInfo 
app.) www.total.net/~rparis/gisproducts.htm 

 


  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of Scott HallSent: June 8, 2000 11:08 AMTo: 
  'Possberg, Hendrik (Fa. Microm)'Cc: 
  '[EMAIL PROTECTED]'Subject: RE: MI Nodes in 
  Polylines
   1. Is it possible to get the number of nodes in a 
  Polyline? 
  Getting the number of nodes for a pline is found through 
  ObjectInfo. 
  Dim bObject As Object Dim nNumNodes As 
  Integer [Jacques Paris]Dim nCntr as 
  integerbObject = PolylineTable.Obj 
  [Jacques Paris] the following line will give you the total 
  number of points in all segments
  nNumNodes = 
  ObjectInfo(bObject, OBJ_INFO_NPNTS) 
   2. in the next step I would like to get the coordinates 
  for all the nodes which are  building a polyline. 
  Use the ObjectNodeX and ObjectNodeY commands to grab the x and 
  y coordinates of the nodes. You can use a counter to loop thru the 
  polyline node by node. It would also be helpful to check for plineness - 
  ObjectInfo(bObject, OBJ_INFO_TYPE) - before the loop as I have found MapBasic 
  to be a little tipsy with ObjectNode and a regular old line.
  Dim Xcoord As Float Dim Ycoord As 
  Float
  [Jacques Paris]Dim nseg, j as 
  smallint
  nseg=objectinfo(bOject,21) 
  '21or obj_info_npolygons
  for j=1 to nesg
  nNumNodes= 
  objectinfo(bObject,21+j)
  For nCntr = 1 To nNumNodes 
   Xcoord = 
  ObjectNodeX(bObject,j, 21+nCntr) 
   Ycoord = 
  ObjectNodeY(bObject,j , 21+nCntr ) Next 
  [Jacques 
  Paris]Next