ThinkGeo.com    |     Documentation    |     Premium Support

How to plot my locations in map

Hai All,


Am new  to this tool. Am using Desktop edition 3.0 in WPF(C#). i succesfully loaded my geotif map image in wpf window form. and now my requirement is to locate my points in the map. my location points are in (.csv) file format. is it possible to load csv location points in geotiff.?? if so can any on tell me how to do it else if possible tell me some sample code. it might be help lot.



dCODE, 
  
 Welcome to MapSuite’s world. 
  
 First, you need to get the longitude and latitude from csv file by your code. And then you can create a InMemoryFeatureLayer and add the point to it. Make sure you set the right style and zoomlevel. 
 Please look at our HowDoI sample PlotALatitudeAndLongitudePointOnTheMap which is exactly what you want. 
  
 Let me know if you have more questions. 
  
 Thanks 
 James

when am trying to run the how do i samples am getting object reference error in wpfMap1.Refresh(); 
  
 whats the reason?

Hi dCODE, 
  
 We need to clarify some information with you to solve this problem: 
  
 1. Could you please tell us the name of the sample which raises this exception? 
 2. Could you please give us the version number of the DesktopEdition that you are using? 
 3. And could you please paste some detail information about this exception? Such as the exception type and stack trace? 
  
 Any more information about this is appreciated. 
  
 Thanks, 
  
 Sun 


-- in every sample application am getting that error. only in wpfMap1.Refresh(); line. 

--version 3.0 

--Exception  


Stack tree 



at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas) 

at ThinkGeo.MapSuite.DesktopEdition.WpfMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1) 

at ThinkGeo.MapSuite.DesktopEdition.WpfMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e) 

at ThinkGeo.MapSuite.DesktopEdition.WpfMap.xe3cee4adb9c72451() 

at ThinkGeo.MapSuite.DesktopEdition.WpfMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a) 

at ThinkGeo.MapSuite.DesktopEdition.WpfMap.Refresh() 

at CSWpfHowDoISamples.ConvertWorldCoordinatesToScreenCoordinates.ConvertScreenCoordinateToWorldCoordinate_Load(Object sender, RoutedEventArgs e) in C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\CSharp Wpf How Do I Samples\Screen & World Coordinates\ConvertWorldCoordinatesToScreenCoordinates.xaml.cs:line 47 

at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 

at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 

at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 

at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) 

at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) 

at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) 

at MS.Internal.LoadedOrUnloadedOperation.DoWork() 

at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() 

at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 

at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 

at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 

at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 

at System.Windows.Threading.DispatcherOperation.InvokeImpl() 

at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 

at System.Threading.ExecutionContext.runTryCode(Object userData) 

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 

at System.Windows.Threading.DispatcherOperation.Invoke() 

at System.Windows.Threading.Dispatcher.ProcessQueue() 

at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 

at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 

at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 

at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) 

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 

at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 

at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 

at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 

at System.Windows.Threading.Dispatcher.Run() 

at System.Windows.Application.RunDispatcher(Object ignore) 

at System.Windows.Application.RunInternal(Window window) 

at System.Windows.Application.Run(Window window) 

at System.Windows.Application.Run() 

at CS_Wpf_HowDoISamples_For_Debug.App.Main() in C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\CSharp Wpf How Do I Samples\obj\x86\Debug\App.g.cs:line 0 

at System.AppDomain._nExecuteAssembly(Assembly 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) 

at System.Threading.ThreadHelper.ThreadStart() 

 



Hi dCODE, 
  
 About the version number, it will be better if you can give us a more detail one, like 3.1.299. And we noticed that you seem to using a 64-bit operation system, we want to know what operation system you are using so that we can deploy an environment which is just like yours to recreate your problem. We haven’t reproduced the exception you mentioned in this post so far, and we will continue to work on this. Please keep an eye on this thread; we will let you know as soon as possible once we have a result. 
  
 Sorry for the inconvenience. 
  
 Thanks, 
  
 Sun 


version 3.1.299 
 Windows XP Professional (64-bit)

Thanks for providing this information to us. We will work on this as soon as possible once we deployed the same clean machine environment as yours. 
  
 Any more questions please let us know. 
  
 Thanks, 
  
 Sun 


 


dCODE,
 
Thank Sun’s help!
 
I have tested this issue and found the reason is that you’re offline or your internet can not access our WorldMapKit Wms Server.
 
You can remove this two lines code to confirm with this problem.
 
WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
wpfMap1.Overlays.Add(worldMapKitDesktopOverlay);
 
Please let me know if you have another questions.
 
James

No james, am online only. connected to internet. but still same problem, This error occurs in half of the samples only.. other samples working well.



dCODE, 
  
 Could you please have a try use James’s method? Try to remove the WorldMapKit overlay from the sample to see if the error still happens. We want to make sure if the problem exists in the WorldMapKit overlay. If not, could you please give us two samples’ name, one of them has the error and the other doesn’t, so that we can compare the code to see how this problem is raised. 
  
 Any more information about this is appreciated. 
  
 Thanks, 
  
 Sun 


Most Example throwing error. 
 -Plot a latitude and longitude on map 
 -Load a shape file feature layer 
 -Draw using Zed Graph 
  
 Some of them working properly 
 -Display a feature layer only at certain scale 
 -Loading a sattelite image 
  
 Error Stack Tree 
  
 System.NullReferenceException was unhandled 
   Message="Object reference not set to an instance of an object." 
   Source="DesktopEdition" 
   StackTrace: 
        at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas) 
        at ThinkGeo.MapSuite.DesktopEdition.WpfMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1) 
        at ThinkGeo.MapSuite.DesktopEdition.WpfMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e) 
        at ThinkGeo.MapSuite.DesktopEdition.WpfMap.xe3cee4adb9c72451() 
        at ThinkGeo.MapSuite.DesktopEdition.WpfMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a) 
        at ThinkGeo.MapSuite.DesktopEdition.WpfMap.Refresh() 
        at CSWpfHowDoISamples.HighlightAFeatureOnTheMap.HighlightAFeatureOnTheMap_Load(Object sender, RoutedEventArgs e) in C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\CSharp Wpf How Do I Samples\Dynamic Shapes\HighlightAFeatureOnTheMap.xaml.cs:line 56 
        at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
        at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
        at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 
        at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) 
        at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) 
        at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) 
        at MS.Internal.LoadedOrUnloadedOperation.DoWork() 
        at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() 
        at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 
        at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 
        at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 
        at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 
        at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
        at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
        at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
        at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
        at System.Threading.ExecutionContext.runTryCode(Object userData) 
        at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 
        at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
        at System.Windows.Threading.DispatcherOperation.Invoke() 
        at System.Windows.Threading.Dispatcher.ProcessQueue() 
        at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
        at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
        at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
        at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 
        at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
        at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
        at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 
        at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) 
        at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
        at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
        at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
        at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
        at System.Windows.Threading.Dispatcher.Run() 
        at System.Windows.Application.RunDispatcher(Object ignore) 
        at System.Windows.Application.RunInternal(Window window) 
        at System.Windows.Application.Run(Window window) 
        at System.Windows.Application.Run() 
        at CS_Wpf_HowDoISamples_For_Debug.App.Main() in C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\CSharp Wpf How Do I Samples\obj\x86\Debug\App.g.cs:line 0 
        at System.AppDomain._nExecuteAssembly(Assembly 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) 
        at System.Threading.ThreadHelper.ThreadStart() 
   InnerException:  


dCODE, 
  
 I am curious that if dCODE is your really name? If not, please let me know your name, I think it’s not friendly that always reply the wrong name. 
  
 The three samples which will throw exception are using WorldMapKitWmsDesktopOverlay, the two samples which won’t throw exception are not using WorldMapKitWmsDesktopOverlay. So the conclusion is the same as I said. Your network can not connect our wms server. 
  
 If you want to connect our server, please contact your network administrator and solve the problem. Or you can add this code to avoid exception 
             worldMapKitDesktopOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException; 
  
 If you don’t, just remove the two lines code for WorldMapKitWwmDesktopOverlay. 
  
 We already plan to enhance WorldMapKitWwmDesktopOverlay and make it has better user experience. 
  
 Thanks 
 James

Hi james,


i tried by removing those two lines. but it still throwing the error. okie, let me check in some other machine and let u know soon. sure james wil change my name in a while.


thanks for your reply. 


and i have posted another question plz go thru that



Hi deep, 
  
 Your name is very special, it seems you are not the American, but I am still glad to answer your questions. 
  
 Have you rebuilt the HowDoI samples? Sometimes, if you click build button, it won’t rebuild, just run the original application from bin folder, so the best way to test this issue is that you remove all files from bin folder, and then run it again. 
  
 Thanks 
 James

Helo james 
      you are right. am Indian. why james indians should not work on your tool ah… LoL.  james i have tried that too. but same problem. am installing it in another machine 32-bit,. after that i wil found the real issue and let you know about this soon. james need another clarification for this…  gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6941/afv/topic/Default.aspx

deep, 
  
 The world is flat. 
  
 Hope you can find the real issue. 
  
 I will reply to you at another post. 
  
 James