We are working with some map data such as *.000 (S57), *.dgn.
How can I use them with MapSuite API?
Plz, recommend me the way to work with.
We are working with some map data such as *.000 (S57), *.dgn.
How can I use them with MapSuite API?
Plz, recommend me the way to work with.
Hello duong,
We do support s57 and dgn file loading and you will need use FdoExtension.
1. Reference the DLL FdoExtension, other wise you could not see the S57FeatureLayer class.
2. Copy the Folder MapSuiteFdoExtensionx86 from thinkgeo install folder to “C:\WINDOWS\system32”
Private Sub ShowHideLayer_Load(ByVal sender As Object, ByVal e As EventArgs)
winformsMap1.MapUnit = GeographyUnit.DecimalDegree
winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
Dim fileName As String = "C:\Post7521\US4CN22M\US4CN22M\US4CN22M.000"
Dim s57FeatureLayer As S57FeatureLayer = New S57FeatureLayer(fileName, "FID", "OGRSchema", "Area")
s57FeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1
s57FeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim staticOverlay As New LayerOverlay()
staticOverlay.Layers.Add("WorldLayer", s57FeatureLayer)
winformsMap1.Overlays.Add("WorldOverlay", staticOverlay)
winformsMap1.CurrentExtent = New RectangleShape(-139.2, 92.4, 120.9, -93.2)
s57FeatureLayer.Open()
winformsMap1.CurrentExtent = s57FeatureLayer.GetBoundingBox()
s57FeatureLayer.Close()
winformsMap1.Refresh()
End Sub
And support dgn is the same as s57 but just use OgrFeatureLayer.
Let us know your queries.
Regards,
Gary
Hi Garry,
Where can i find " DLL FdoExtension"?
I’ve completed the second step: "2. Copy the Folder MapSuiteFdoExtensionx86 from thinkgeo install folder to “C:\WINDOWS\system32” ".
DuongNV.
Hi duong,
You can find the dll from the daily build dll pacakge.
Production Build:
Development Build:
Hope it helps,
Edgar
I 've added dll completed, but I don’t understand some parameters of S57FeatureLayer.
+ pathFileName: very easy
+ idColumnName: how can I get?
…
Please share me tool what I get these parameters from my s57 files.
Thanks alot!
My code:
S57FeatureLayer sg1 = new S57FeatureLayer(@“E:\working\project\vts\HAI DO DIEN TU 24-04-2012
\HAI DO DIEN TU 24-04-2012\Gui_cang_vu_18-04-2012\Gui_cang_vu_18-04-2012\SAI GON\VN4SG001.000”, “FID”);
My exception is:
System.TypeLoadException was unhandled
Message=Method ‘GetAllFeaturesCore’ in type ‘ThinkGeo.MapSuite.Core.FdoFeatureSource’ from assembly ‘FdoExtension, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.
Source=FdoExtension
TypeName=ThinkGeo.MapSuite.Core.FdoFeatureSource
StackTrace:
at ThinkGeo.MapSuite.Core.S57FeatureLayer…ctor(String pathFilename, String idColumnName, String featureSchemaName, String featureClassName, String geometryColumnName)
at ThinkGeo.MapSuite.Core.S57FeatureLayer…ctor(String pathFilename, String idColumnName, String featureSchemaName, String featureClassName)
at ThinkGeo.MapSuite.Core.S57FeatureLayer…ctor(String pathFilename, String idColumnName)
at MapDesktop1.Form1.Form1_Load(Object sender, EventArgs e) in E:\working\project\tmpCode\mapdesktop\MapDesktop1\MapDesktop1\Form1.cs:line 26
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MapDesktop1.Program.Main() in E:\working\project\tmpCode\mapdesktop\MapDesktop1\MapDesktop1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Hello duong,
I think this exception is because you are using the wrong version dlls, could you please let me know your MapSuite dll version and FdoExtension dll version?
Regards,
Gary
Hi Gary,
Version Core API: v2.0.50727
Version FDO: v4.0.30319
Hello duong,
What’s the meaning of Core API? And our newest FDO should be 6.0.xx.0 or 6.0.0.xx, 4.0 is a very old version.
Could you please upgrade to the newest version and have another try? You can download it from helpdesk.thinkgeo.com.
Regards,
Gary
Hi Gary,
GeoAPI, MapsuiteCore, DesktopEdition version is: 6.0 (I’ve downloaded since a month)
FDO extension version: 6.0.133.0
DuongNV.
Hello duong,
Sorry I asked the version problem third time, is your MapsuiteCore and DesktopEdition are 6.0.133.0 as same as the FDO extension version?
If so, I think there isn’t any problem about the dlls now, could you please provide your sample to us? I can make some test on it.
Regards,
Gary
Hi Gary,
+ MapsuiteCore and DesktopEdition is the Version 6.0.0.0 — Released 5/17/2012 — 124 MB
+ FDO extension version: 6.0.133.0
This my code:
private void Form1_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
S57FeatureLayer sg1 = new S57FeatureLayer(@"E:\working\project\vts\HAI DO DIEN TU 24-04-2012
\HAI DO DIEN TU 24-04-2012\Gui_cang_vu_18-04-2012\Gui_cang_vu_18-04-2012\SAI GON\VN4SG001.000", "FID");
sg1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
sg1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(sg1);
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.CurrentExtent = new RectangleShape(0, 78, 30, 26);
winformsMap1.Refresh();
}
Exception throwed from this code: S57FeatureLayer sg1 = new S57FeatureLayer(@"E:\working\project\vts\HAI DO DIEN TU 24-04-2012
\HAI DO DIEN TU 24-04-2012\Gui_cang_vu_18-04-2012\Gui_cang_vu_18-04-2012\SAI GON\VN4SG001.000", "FID");
Hello duong,
Could you please using the Core and Desktop Edition dll as same as the FDO extension version? A good idea is upgrade to the newest version 6.0.144.0 for all the dlls, and please notice you need using the framework 4.0 for this.
If you still can’t make it work after you using the newest dlls, could you please provide a sample with your data file together? Sorry it’s working fine on my side with the code.
Regards,
Gary
Hi Gary,
I’ve passed error of version dll, but I meet some other errors:
This 's my code:
S57FeatureLayer sg1 = new S57FeatureLayer(@“E:\working\project\vts\HAI DO DIEN TU 24-04-2012\HAI DO DIEN TU 24-04-2012\Gui_cang_vu_18-04-2012\Gui_cang_vu_18-04-2012\SAI GON\VN4SG001.000”, “FIDS”);
sg1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
sg1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(sg1);
// We need to add the layer overlay to Map.
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.CurrentExtent = new RectangleShape(100, 25, 125, 7);
winformsMap1.CurrentScale = 5000000;
Feature f = new Feature(107, 16);
ScreenPointF screenPoint = ExtentHelper.ToScreenCoordinate(new RectangleShape(100, 25, 125, 7), f, 1328, 706);
winformsMap1.MapClick += new EventHandler<MapClickWinformsMapEventArgs>(winformsMap1_Click);
winformsMap1.CenterAt(screenPoint);
winformsMap1.Refresh();
And this 's my exception:
System.Reflection.TargetInvocationException was unhandled
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at ThinkGeo.MapSuite.Core.FdoFeatureSource.OpenCore()
at ThinkGeo.MapSuite.Core.FeatureSource.Open()
at ThinkGeo.MapSuite.Core.FeatureLayer.OpenCore()
at ThinkGeo.MapSuite.Core.Layer.Open()
at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.rRM=(GeoCanvas rhM=)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.yhU=(IEnumerable`1 yxU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.yBU=(RectangleShape yRU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.FxY=()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ExY=(Int32 FBY=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()
at MapDesktop1.Form1.Form1_Load(Object sender, EventArgs e) in E:\working\project\tmpCode\mapdesktop\MapDesktop1\MapDesktop1\Form1.cs:line 52
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MapDesktop1.Program.Main() in E:\working\project\tmpCode\mapdesktop\MapDesktop1\MapDesktop1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=MapSuiteFdoExtension
StackTrace:
at MapSuiteFdoExtension.GeoFdoFeatureSource.Open(String providerName, String connectionString, String idColumnName, String featureSchemaName, String featureClassName, String geometryColumnName)
InnerException:
Hi Duong,
I am in the proces of setting up a clean environment to test this properly. I was getting a version mismatch issue and want to make sure I am testing this on a ‘clean’ machine.
Hi Duong,
Thanks for your patience. The issue is a Mixed Mode Assembly issue with one of the assemblies that the FDOExtension.dll references. When you moved your application to use the 6.0.144.0 version of our Dlls, Visual Studio asked informed you that the 'FDOExtension.dll', or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project.' Thus you probably updated you project to the .NET 4.0 Framework. This is what is causing the exception.
There are two ways to work around this issue.
The first option involves using the same 6.0.144.0 version you are currently referencing so you don't need to make any reference changes.
To use the .NET 4.0 framework as the Target Framework of your application, use the FDOExtension and avoid the MixedMode Exception you will need to add the following to your app.config:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
The other option involves reverting back to the 6.0.0.0 Release version dlls and setting your Appliction to use the .NET 3.0 or 3.5 Framework.
Hi Ryan,
I have by passed MixedMode problem already, but still got error like upon.
DuongNV.
Hi Duong,
I assume you are referring to this exeption from above?:
System.Reflection.TargetInvocationException was unhandled
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
This maybe an issue with the specific S57 file that you are attempting to load. Can you perhaps provide us this file so that we might recreate the issue and perhaps debug it further?
If your file is larger than 500k you will need to login to the ThinkGeo Customer Portal located at helpdesk.thinkgeo.com, create a Ticket and attach your S57 file to the ticket.
An e-mail will be sent containing your login credentials for the Customer Portal so be sure to check your Junk and Spam folders for this information.
Hello duong,
Thanks for your post and data, now we have upgrade the FDO extension to make it support the .Net 4.0, as my test, this exception resolved, I will post here again once we finished the full test and upload the new FDO extension dll to our website.
But I have one more question, once I opened the s57 file VN4SG003.000 which you provide, no exception throws but I can’t see anything shows, can you make sure if this data file has no problem? If you can see it with some other way, can you guide me how to do it?
Regards,
Gary