MapInfo Pro Developers User Group

 View Only
Expand all | Collapse all

Integrated Mapping and MapInfo file dependencies

  • 1.  Integrated Mapping and MapInfo file dependencies

    Posted 01-28-2020 07:37
    Edited by Jonas Nordlund 01-28-2020 07:38
    Hi!

    The "official approach" here has always been a bit unclear to me, and now I remembered to ask!

    Background: We build multiple import & export routines to/from our GIS application that is using MapInfo as its map engine. E.g. importing details daily from customer or billing systems into MapInfo tables, etc. so that we can integrate this data into our application. In MapInfo 15 and older, we interfaced via its MapInfo COM object (MapInfo.Application/Runtime). This meant multiple routines in their own file folders and also our main GIS application itself could all share a single MapInfo Runtime install on the respective client systems.

    With MapInfo 16 (64 bit) and onwards, MapInfo rather seem to be meant to run "in-process" and not by using a COM object. For example, you build a .NET application with a reference added to MapInfo.Application.dll and so on.

    The problem: To actually run our applications, it now needs to basically have all the DLL's of MapInfo (and more!) in our application folder or it'll complain upon startup. It doesn't even run if we just leave it with what Visual Studio detected as dependent files. We need to pull in even more, basically everything. And if we need one of those small daily routines that depends on MapInfo, these need essentially the entire MapInfo folder too. So we're talking ~700 MB data for each separate use of MapInfo here! In the 'Samples' that come with MapInfo, this is solved by compiling Integrated Mapping tools into the MapInfo Program Folder itself. This is frowned upon in Windows since it's not very friendly due to User Access Control and we really don't want to litter that folder with our applications and services within the MapInfo folder!

    My question: Is there any way to e.g. give a path to where our applications should look for the MapInfo dependent files so they can be shared? This could help us save gigabytes of storage space per client. I'm not even sure how this works out for MapInfo licensing. Currently we just distribute the same MapInfo Runtime install (copy & pasting the files) into each folder where it's needed per client.

    ------------------------------
    Jonas Nordlund
    Software developer
    Norconsult AB
    Sweden
    ------------------------------


  • 2.  RE: Integrated Mapping and MapInfo file dependencies

    Employee
    Posted 01-28-2020 17:52
    Hi Jonas,

    First let me answer your question, then I'll ask one...

    We recommend calling SetDllDirectory to the Pro folder. Here is some code from our integratedmappingwpf sample:

    namespace MapInfo.MiPro.Samples.IntegratedMappingWpf
    {
    	internal static class MainClass
    	{
    		[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
    		[return: MarshalAs(UnmanagedType.Bool)]
    		static extern bool SetDllDirectory(string lpPathName);
    
    		[STAThreadAttribute]
    		public static void Main(string[] args)
    		{
    			// Change this to MapInfo Pro installation directory.
    			SetDllDirectory(@"C:\Program Files\MapInfo\Professional\");
    			// Startup the MapInfoCore
    			if (MapInfoCore.StartUp(args))
    			{
    				var app = new App();
    				app.Run(new MainWindow());
    			}
    		}
    	}

    Let me know if this helps. I think we also have a support white paper about this topic.

    We do support talking to MapInfoPro 64-bit versions via COM, although the re-parenting of map and other windows was not supported.
    I am personally working on restoring some of the missing functionality -- specifically 'set next document parent' for Map Windows in order to make it easier for people such as yourself to move to newer versions of Pro. We realize that we left a hole for out-of-process usage of Pro maps and would like to remedy that.

    Can you post here or privately if you are interested in trying out a preview of this work, and also can you let me know what other features of Pro you used via COM or in general what would make it easier to get your apps running against 64-bit Pro?

    -Bob

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 3.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 01-29-2020 04:23
    Edited by Jonas Nordlund 01-29-2020 04:24
    First, I had completely missed the SetDllDirectory call. Interesting -- I'll definitely look into that further! Thanks for the sample code.

    The missing map reparenting support in MapInfo Pro 64-bit COM rings a bell and that did cause it to not be an option for our flagship GIS application. However, we decided to make a major transition from C++ and MFC to .NET here which we're months into right now. That means we're using .NET (WPF) and MapInfo as a project reference, so we are currently not being held back by this. We may start to use that SetDllDirectory call in it though to clean up our application folder and assist with distribution.

    The trouble for us rather revolved around all our smaller (command line) applications that integrates various systems with our GIS application, where we need to rely on MapInfo as well due to MapInfo table support. Sometimes it feels like every new customer has a new special need. :) And this is where we've been reluctant to use the ".NET and references" model. However, both the SetDllDirectory and the retained COM option (again, no need to reparenting here) sound like good alternatives that we'll check out. We were a little unsure if the COM option was "on its way out" since it sounded de-emphasized in documentation with .NET coming on so strongly so we've been careful starting new projects relying on that, but it sounds like this was an unfounded concern.

    ------------------------------
    Jonas Nordlund
    Software developer
    Norconsult AB
    Sweden
    ------------------------------



  • 4.  RE: Integrated Mapping and MapInfo file dependencies

    Employee
    Posted 03-03-2020 16:53
    Hi Jonas,

    We have been able to get the COM re-parenting officially working via "set next document parent" for map and browser windows and it will be included in our upcoming 2019.1 release.

    I hope this will help ease your transition.

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 5.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 03-06-2020 02:47
    Hi Bob,

    do i get that right: With the upcoming release of 2019.1 it will be possible again to display a MapInfo MapWindow in a, - let's say: MS-Access Form through re-parenting? And all the interactions that are possible with a Map-Window of MiPro 15 would be possible as well?
    Or did you mean something different and there are other shortcomings of this new implementation?

    Thanks for any information or hints to ressources about this.
    and
    best regards

    Stefan


  • 6.  RE: Integrated Mapping and MapInfo file dependencies

    Employee
    Posted 04-24-2020 08:58
    Hi @Stefan Hausmann,

    Have you been able to try out the re-parenting in 2019.1?

    It works for map and browser windows. For 2019.2 we are looking to bring back support for re-parenting info, statistics, ruler, message and legend window as well.

    -Bob​

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 7.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 04-25-2020 10:24
    Hello Bob,

    thanks for asking.
    My first install of 2019.1 maintenance release wrecked the ms office installation and all MiPro installations on that machine and i had to un- and reinstall them all. So i wasn't keen on trying this again.

    Has this installation issue of 2019.1 (MS-Access 64-Bit Engine 2016) been resolved?

    I would really like to test this, - one of my customers heavily depends on that functionality.

    have a nice weekend
    and
    best regards

    Stefan


  • 8.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 04-25-2020 10:49
    Hello Stefan,

    Installer has been rebuilt and you can download it again and it should work much better with installed Office.

    Please give it a try.

    Regards,
    Andrei

    ------------------------------
    Andrei Veselov
    Pitney Bowes Software Inc.
    Troy NY
    ------------------------------



  • 9.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 04-26-2020 04:11
    Hello Andrei,

    tried your new installer on a different machine running office 2016 today and had no issues so far: Office programs still working, MiPro 15 & 2019.1 can open Access files, - the mentioned registry entry doesn't exist after the install.

    would have been better without customer-beta-testing...

    Thank you anyway and i'll try using it in an access form next week.

    bestr regards
    Stefan


  • 10.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 04-29-2020 03:10
    Where the new patch for MiPro 2019.1 is?

    I don't see any link to download.

    Thanx before.

    -Mati Tee-

    ------------------------------
    Mati Tee
    Ruumab OÛ
    Tartu
    ------------------------------



  • 11.  RE: Integrated Mapping and MapInfo file dependencies

    Posted 04-29-2020 04:50
    Hi,

    you can find it under the original 2019.1 announcement in the MapInfo Community:

    https://community.pitneybowes.com/communities/community-home/digestviewer/viewthread?GroupId=19&MessageKey=8fbc705f-2d56-4ff0-9331-24244c83e7aa&CommunityKey=fe4d1ee2-f1c6-4307-87d2-00bea1344885&tab=digestviewer&ReturnUrl=%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3dfe4d1ee2-f1c6-4307-87d2-00bea1344885%26tab%3ddigestviewer

    it's the same link for the improved installer.

    Cheers
    Stefan