Not all methods available in the interop dlls?
Reported by Djordje Spasic:
I would like to use MapWinGIS/MapWindow to convert an .osm file to a .shp file through their OGR2OGR function.
I would like to do that inside of application called Dynamo. It is a free and open-source application for architects, and it has an ironpython 2.7 interpreter. What I do is load the Interop.MapWinGIS.dll and AxInterop.MapWinGIS.dll files through that ironpython interpreter, and then I access all the MapWinGIS or MapWindow functions (like upper mentioned OGR2OGR function).
I have two problems:
1) I can only access these MapWinGIS functions if I have installed:
a) MapWindow x86 v4.8.8 (188.8.131.52, release date: 1 August 2013)
b) The following MapWinGIS versions:
MapWinGIS Win32 v184.108.40.206 (released Dec. 3, 2015)
pre-release MapWinGIS Win32 v220.127.116.11 (released Dec. 3, 2015)
MapWinGIS Win32 v18.104.22.168 (released not yet)
MapWinGIS Win32 v22.214.171.124 (released Jun 9, 2016)
but only after the upper mentioned MapWindow x86 v4.8.8 is installed.
So for example, if I install MapWinGIS Win32 v126.96.36.199, and I try call any function from the Interop.MapWinGIS.dll file, I am getting the following error message:
The same thing happens if I install any of the other mentioned MapWinGIS Win32 versions (188.8.131.52, 184.108.40.206, 220.127.116.11): If MapWindow x86 v4.8.8 is installed after their installation, everything works fine. If MapWindow x86 v4.8.8 is not installed, the "Retrieving the COM class factory" error always appears, whenever I try to call any function.
2) The second problem I have is that once "everything works fine" (meaning: MapWindow x86 v4.8.8 is installed after any version of MapWinGIS Win32, and I can call any MapWinGIS/MapWindow function or property), the "OSM driver" is missing from the MapWinGIS.Utils.OGRInfo function. Which results in me not being able to convert an .osm file to .shp file by using the MapWinGIS.Utils.OGR2OGR function. When I try to do that, the MapWinGIS.GlobalSettings.GdalLastErrorMsg always returns this:
So why is "OSM" driver missing?
Paul told me that for example on his PC, the MapWinGIS Win32 v18.104.22.168 version has an OSM driver listed when MapWinGIS.Utils.OGRInfo function is called. But on my PC, it is not listed, neither it is listed on MapWinGIS Win32 v22.214.171.124, v126.96.36.199, v188.8.131.52 nor MapWindow x86 v4.8.8. And all of these versions raise the same: "FAILURE: Unable to open datasource `C:/map.osm'." error message.
These two issues have been bugging me for more the last 6 months, and it disables me to complete my ironpython script. The ironpython script that I am trying to do is to download an .osm file from the openstreetmap.org, convert it to a .shp file, and then open that .shp file through the use of MapWinGIS functions. This shp file will then be opened in Dynamo application. I succeeded in doing the last part with the help of Paul Meems (thank you!). The only part of the puzzle that is missing is converting and .osm file to a .shp file.
The ironpython script is to be released in a form of a free, and open-source ironpython script. I will not benefit from it. The script will be a part of the Ladybug open-source voluntary group, of which I am a member of.
One of the reasons why I use the x86 and Win32 MapWindow/MapWinGIS is because my PC configuration is quite poor, and I still use Windows XP 32 bit SP3.
I am an architect by education, not a programmer nor GIS specialist. I only know how to write some modest code in ironpython/python, and that is it.
I apologize for disturbance. I would be very grateful for any kind of help on this issue, as I became pretty desperate.
Thank you in advance.
Kind regards from Serbia,
did an in-dept investigation of the Dependency Walker file Djordje send to him and Sergei concluded the following:
There is a procedure InitializeConditionVariable in kernel32.dll. It's used by libmysql.dll which in turn is used by gdal201.dll which is used by MapWinGIS.ocx. According to documentation the minimum supported client is Windows Vista: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683469(v=vs.85).aspx. Here is a similar error report for completely different app: http://stackoverflow.com/questions/24203316/mysql-connector-c-version-6-on-windows-xp.
Djordje is running WinXP.
In reaction on Sergei's conclusion Djordje did the following:
I tried to simply replace the libmysql.dll file (version 184.108.40.206) with the same file but from GDAL C# libraries ("release-1500-gdal-1-11-1-mapserver-6-4-1.zip").
For some reason I can not check the version of that libmysql.dll, but judging by it being used for GDAL 1.11.1 I think it is older than 220.127.116.11.
And it worked !!!
The "COM class factory" error disappeared and the OSM driver is present when MapWinGIS.Utils.OGRInfo method is run.
Djordje can now continue with his IronPython script and I close this issue.