Other Software and Data

 View Only
  • 1.  Insert feature in a thread (MapXtreme)

    Posted 07-24-2020 09:26
    Hello everybody,

    I would like to insert feature at regular interval.
    I would like to know how or if it is possible to use insertfeature inside a thread in MapXtreme.
    It works when I use it normally but with a timer or a thread, I get an error : Unable to parse statement : Invalid identifier.

    Thanks you,

    Augustin

    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------


  • 2.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-04-2020 13:14
    Hi Augustin

    I don't think you can use a thread as the map catalogue is unique to each thread. By default you will have your map and map catalogue on the main UI thread. If you then try and access the map catalogue from a background thread it is not the same catalogue as you have on the UI thread.

    Regards

    Liz

    ------------------------------
    Liz Walker
    ------------------------------



  • 3.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-05-2020 04:28
    Hi Liz,

    Thanks for your answer.
    Ok, but do you have any idea if I can insert a feature automatically at regular interval?
    Because the thread works, I have my coordinates each x seconds and I can create a point from them, the problems is when I try to insert it in a database.


    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------



  • 4.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-05-2020 05:48
    I don't see why not. I create features and programatically add them to tables all the time using the following sort of thing:-

    var newFeature = new Feature(table.TableInfo.Columns)

    ...assign values to feature, create geometry etc....

    table.InsertFeature(newFeature)

    This works fine on Mapinfo Native tables, I don't use database connections so can't comment on that side of things. How are you trying to do it?

    ------------------------------
    Liz Walker
    ------------------------------



  • 5.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-05-2020 06:03
    It works when I use a button or I click on the map or whatever.
    But it bugs when I use a thread to insert automatically.


    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------



  • 6.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-05-2020 07:01
    Yes, it will because the catalogue on the thread is empty. so there are no tables available to insert it into. The catalogue with your tables in only exists on the ui thread (unless you add some explicitly to the catalogue on your background thread).

    Try executing Session.Current.Catalog.Count on both the main ui thread and the background thread. It returns the number of tables in the map catalogue for the current thread.

    regards

    Liz

    ------------------------------
    Liz Walker
    ------------------------------



  • 7.  RE: Insert feature in a thread (MapXtreme)

    Posted 08-05-2020 08:28
    Fine, it works.

    Thanks you very much.


    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------