@djordje wrote:
Hello,
I am currently struggling to call a method from loaded .dll assembly. Assembly is a part of WinMapGIS and Map Window open source projects for manipulation of GIS data.
The issues is that, I can call any property or method which does not take any arguments.
But once a method requires at least one argument, an error message appears:Could not convert argument 0 for call to Open.
I am basically trying to replicate the C# code which opens a .shp file:
using MapWinGIS; string shpfilename = "C:/example.shp"; Shapefile sf = new Shapefile(); sf.Open(shpfilename, null)Here is the ironpython replication:
import clr clr.AddReferenceToFileAndPath("C:/mapwindow_dlls/Interop.MapWinGIS.dll") import MapWinGIS sf = MapWinGIS.ShapefileClass() shpfilename = "C:/example.shp" sf.Open(shpfilename, None) # raises the error messageOn the last line, an upper error message appears (Could not convert argument 0 for call to Open).
Here is the signature of the "Open" method:
Open(self: ShapefileClass, ShapefileName: str, cBack: Callback) -> bool // MapWinGIS.ShapefileClass [DispId(11)] [MethodImpl(MethodImplOptions.InternalCall)] public virtual extern bool Open([MarshalAs(UnmanagedType.BStr)] [In] string ShapefileName, [MarshalAs(UnmanagedType.Interface)] [In] ICallback cBack = null);Just to make it clear: In upper C# example the
Shapefileclass is used, while I usedShapefileClassclass. The reason is that,Shapefileclass does not containOpenmethod. When I even try to instantiate it:
sf = MapWinGIS.Shapefile() # raises an errorIt raises an error:
Cannot create instances of Shapefile because it is abstract
Looks like
ShapefileClassis an implementing class.I did a little bit of search and the same thing happens at ironruby.
Author of this question states that the issue might be with the type of argument, supplied to the "Open" method (
shpfilenamein this case).I tried seeking for help on both ironpython mailing list, stackoverflow, and by contacting the developer of the MapWinGIS / Map Window projects. But without success.
Here are all the necessary .dll files (the upper
mapwindow_dllsfolder) along withexample.shpfile (.zip file is 27MB in size).I would be very grateful for any kind of help.
Posts: 1
Participants: 1