Extract polyline startnode XY

227 views
Skip to first unread message

geomatics.ch

unread,
May 21, 2008, 8:08:36 AM5/21/08
to MapInfo-L
Hello group,

does anyone have a mapbasic window instructions in order to populate
(update column) of a Polyline table with the x1, y1 of the
startnodes? Or make a new separate Point table of the startnodes
retaining the initial Polyline table IDs?

Thank you!!

geomatics.ch

unread,
May 21, 2008, 8:47:40 AM5/21/08
to MapInfo-L
What I've found so far....

ObjectGeography (obj,1) ==> StartX
ObjectGeography (obj,2) ==> StartY
ObjectGeography (obj,3) ==> EndX
ObjectGeography (obj,4) ==> EndY

but this seems to be for the MBR (minimum bounding rectangles) of
every polyline, not the actual startnodes, so still searching....


Uffe Kousgaard

unread,
May 21, 2008, 8:55:46 AM5/21/08
to mapi...@googlegroups.com
It is the objectnodex / y function and the objectinfo function from before
you need.

Search the archieves for objectnodex and you will find your question
answered previously (I'm almost sure, anyway).

Regards
Uffe Kousgaard

Bill Thoen

unread,
May 21, 2008, 9:11:25 AM5/21/08
to mapi...@googlegroups.com
You'll need to put at least two pairs of coordinates into a polyline or
it won't form a stable object, and the command statement is "Create
Pline into Variable ..." The relevant function to build an object that
contains only a single point is CreatePoint() . Then to turn it into a
Pline later, you use "Alter Object obj Node Add..." The biggest problem
is that you can't update a table with the Create Pline or Alter Object
statements. These work only on one object at a time, and what you have
to do is select a row from your table, extract its object into a
variable, alter that object, and finally update just that row with your
altered object.

This is easy in MapBasic where you can write a program to either loop
through all the records or write an update function, but if you're
trying to do this in MapInfo's UI, you'll find it tedious in the extreme.

geomatics.ch

unread,
May 21, 2008, 9:23:25 AM5/21/08
to MapInfo-L
Thank you for pointing me in the right direction.
For now, I've found that I can resolve the initial part of my problem
with:


ObjectNodeX(obj,1,1)
ObjectNodeY(obj,1,1)


This does in fact return the startnodeX and startnodeY of a polyline
(even one with multiple sections)


Isabella
P.S. And yes, learning mapbasic is next on my list ;D

AlbertT

unread,
May 21, 2008, 10:39:08 PM5/21/08
to MapInfo-L
geomatics,

Uffe is right, you need to use the objectnode*... function.
Here u go....type in MB window and run:

Make sure you set your coordsys...like
---------------------------------------
Set CoordSys Earth Projection 3, 33, "ft",
-120.5, 43.6666666667, 44.3333333333,
46, 8202099.7379999999, 0


Add column Pline2Pt(x1) from Tbl3 set to objectnodex(obj,1,1) where
ID= ID
Add column Pline2Pt(y1) from Tbl3 set to objectnodeY(obj,1,1) where
ID= ID
Update Pline2Pt set obj = createpoint(x1,y1)
---------------------------------------

This will convert the polyline to their respective starting points.
You then can save the table with a different name to preserve
the coordinates then revert the changes in your original table.

Take note that the x1,y1 in the original table are only temp fields.
when you close the table and open again...they're gone!
They can be preserved when saving the session as a workspace.
They become permanent fields when saved out with a different name.


hope this is what you want==============

Albert Tabino
Systems Analysis/GIS
Asset Systems Management
Bureau of Environmental Services
Portland, OR
alb...@bes.ci.portland.or.us
503-823-7225
Reply all
Reply to author
Forward
0 new messages