Question about the Objects Move statement

32 views
Skip to first unread message

Reg Halstead

unread,
Jun 7, 2022, 5:52:46 PM6/7/22
to MapInfo-L
Hello again. I've got just one more question while I'm here if that's okay.

I need to move multiple items based on distances recorded in the table. I tried using the following syntax where DISTFIELD was the field populated with the relevant distances ...

Objects Move Angle 0 Distance DISTFIELD Units "m" Type Spherical

… but sadly the statement doesn't seem to allow for a field to be referenced as the distance, so I had to write a loop thats moves the objects one at a time. The datasets I work with are very large so that means living the loop to work overnight.

Is there a way to move multiple objects by different differences in one go, or is using a loop the only method when dealing with a list of unique distances?

Many thanks,
Reggie

Peter Horsbøll Møller

unread,
Jun 8, 2022, 3:53:02 AM6/8/22
to mapi...@googlegroups.com

Hi Reggie

 

Have you considered using the [Cartesian | Spherical]Offset function?

This can be used directly in an Update statement:

 

Update MYTABLE

  Set OBJ = SphericalOffset(OBJ, 0, DISTFIELD, "m")

 

It also has a cousin:

[Cartesian | Spherical]OffsetXY

 

And if you know what you are doing, or if you work on a copy of your dataset/table, you can use the FastEdit option to speed up the performance:

 

Set Table MYTABLE FastEdit On Undo Off

Update MYTABLE

  Set OBJ = SphericalOffset(OBJ, 0, DISTFIELD, "m")

Commit Table MYTABLE

 

Note: using the FastEdit option eliminates the option to undo your changes, that’s why I recommended working on a copy of your table. Just in case….

In this article, you can read more about improving performance in MapBasic applications and scripts.

 

I hope this helps

 

Peter Horsbøll Møller

www.precisely.com

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Reg Halstead
Sent: 7. juni 2022 21:31
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Question about the Objects Move statement

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/4d44fb53-8d0b-47ea-b042-0e37265a581bn%40googlegroups.com.

Reg Halstead

unread,
Jul 23, 2022, 7:05:59 AM7/23/22
to MapInfo-L
Hi Peter,

Thanks very much for that! Sorry for the delay in thanking you; I had to jump to another project and I've just come back to the one that needed that formula.

That was a massive help!

Best wishes,
Reggie
Reply all
Reply to author
Forward
0 new messages