MapInfo Pro

 View Only
  • 1.  Adding an object to non-spatial row in table

    Posted 01-04-2018 12:59

    I have a table with two rows. Row 2 has an object associated with it. Row 1 does not. I want to take an object (in this case a polygon) from a different layer and associate it with row 1.

    Is this doable?

     

    In the image above I have a polygon associated with row 2 and have drawn a polygon in the cosmetic layer which I would now like to associate with row 1.

    The only way I can think of is to delete and create a new one. But I would like to avoid that as the real data has many columns with a lot of data in them.

     



  • 2.  RE: Adding an object to non-spatial row in table

    Posted 01-04-2018 08:02
      |   view attached

    CaptureSince the image did not attach in the original post:

     



  • 3.  RE: Adding an object to non-spatial row in table

    Employee
    Posted 01-04-2018 09:00
      |   view attached

    MapCAD has some tools that can help you with this.

    1. First you need to select the object that you want to copy.
    2. Then use the MapCAD tool Copy to Stamp to copy the objec to the current Stamp Clipboard.
    3. Now select the record where you want to replace the existing object with the copied object. This might also work with records that don't already have a spatial object.
    4. Finally, click on the MapCAD tool Replace from Stamp.

     

    You can find more help in the MapCAD help system

    MapCAD - Replace From Stamp



  • 4.  RE: Adding an object to non-spatial row in table

    Posted 01-04-2018 09:39
      |   view attached

    Perfect, thank you @Peter Horsbøll Møller? !

    Capture2



  • 5.  RE: Adding an object to non-spatial row in table

    Posted 01-05-2018 05:26

    If you want to do this manually, I wrote an "Object Copy/Paste" tool many years ago which allow you to select an object, copy it, select a target (which in your case would be a row in a browser) and paste it. The attribute data was untouched but the object was replaced (or added). There was a level of danger with this tool as there was no "are you sure?" check prior to the object paste, nor an undo. So, with this destructive power, some care was needed.

     

    If this tool would be useful to you or anyone else, let me know and I'll dig it up. It was from the 32bit era and added "Object copy" and "Object paste" menu items to the Objects menu. The utility is very simple and I'm also happy to share the MapBasic source.



  • 6.  RE: Adding an object to non-spatial row in table

    Employee
    Posted 01-05-2018 05:33

    Living on the edge, eh, Warren 😎

    I'd assume the user could still do a Undo or potentially revert the changes to the table. Or were you using Undo Off and FastEdit on?

    If you want, you can share the tool via the Community Download page: http://communitydownloads.pbinsight.com/

    Thanks



  • 7.  RE: Adding an object to non-spatial row in table

    Posted 01-05-2018 09:20

    If you are doing something like this as a one off and don't need it automated, you can do this:

    (In MapBasic Window)

    dim myobject as object

    (then select your source object from the cosmetic layer)

    (In MapBasic Window)

    myobject = selection.obj

    (then select your target row in your target table)

    (In MapBasic Window)

    update selection set obj = myobject

     

    That would copy the cosmetic layer object to your target row in your target table.



  • 8.  RE: Adding an object to non-spatial row in table

    Posted 01-07-2018 03:50

    Thanks @Warren Vick?, MapBasic code is always good to share :)

    @Ali Mehrabian?, indeed it was a one off, I will check out your suggestion as well.

    I have to say, this LI360 community is pretty awesome time and again!

    Thanks everyone!