Referring to just 1 part of a multipart object. Help required please.

16 views
Skip to first unread message

Reg Halstead

unread,
Jan 30, 2023, 9:47:36 AM1/30/23
to MapInfo-L
Hello,

Does anyone know if there's a function/statement to refer to just one part of a multipart object, please?

Let's say I have a simple table populated with just one object. The object is a combination of two differently-sized polygons which don't overlap and don't contain holes.

There are just 4 fields:

Num_parts - Smallint
Area_all - Decimal(5,1)
Area_1 - Decimal(5,1)
Area_2 - Decimal(5,1)

I can populate the first 2 fields like so ...

Update MYTABLE set Num_parts = objectinfo(obj,21)    
(which would return 2)
Update MYTABLE set Area_all = CartesianArea(obj, "sq m")
(which would return the combined area)

... but I don't know how to specify that I only want to use "part 1" and "part 2" of my object in the following commands:

Update MYTABLE set Area_1 = CartesianArea(???(obj,1), "sq m")
Update MYTABLE set Area_2 = CartesianArea(???(obj,2), "sq m")

Please can someone help me?

I'm sure I worked this out a while ago but I've been unable to retrace my steps. I've searched the MapBasicReference PDF several times but don't know how to find what I'm looking for.

Many thanks in advance,
Reggie

Reg Halstead

unread,
Jan 30, 2023, 10:11:42 AM1/30/23
to MapInfo-L
I'VE FOUND IT!!

Sorry to have disturbed the group for nothing.

The ExtractNodes() function is what I needed and the following works for my example:

Update MYTABLE  Set Area_1 = CartesianArea(ExtractNodes(obj,1,1,objectinfo(obj,22)-1,1), "sq m")
Update MYTABLE  Set Area_2 = CartesianArea(ExtractNodes(obj,2,1,objectinfo(obj,23)-1,1), "sq m")


Reply all
Reply to author
Forward
0 new messages