ThinkGeo.com    |     Documentation    |     Premium Support

InvalidOpertionExcepion on map refresh

Hi everyone!


I'm having an issue and I don't really know where does it come from, but when I try to refresh the map after adding some layers the refresh method shows me this error message: 


This method will return too many cells that might cause performance problem. Please using GetIntersectingRowColumnRange method instead.


Stack trace:


   en ThinkGeo.MapSuite.Core.Matrix.GetIntersectingCells(RectangleShape worldExtent)    en ThinkGeo.MapSuite.Core.BitmapTileCache.GetTiles(RectangleShape worldExtent)    en ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x8d24c2babbc69053(Overlay x32c2370c791132c5)    en ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)    en ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()    en Proyecto_SSER.frmMapa.frmMapa_Load(Object sender, EventArgs e) en C:\PROYECTOS\DESKTOP\Proyecto SSER\Proyecto SSER\frmMapa.vb:línea 434    en System.EventHandler.Invoke(Object sender, EventArgs e)    en System.Windows.Forms.Form.OnLoad(EventArgs e)    en System.Windows.Forms.Form.OnCreateControl()    en System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    en System.Windows.Forms.Control.CreateControl()    en System.Windows.Forms.Control.WmShowWindow(Message& m)    en System.Windows.Forms.Control.WndProc(Message& m)    en System.Windows.Forms.ScrollableControl.WndProc(Message& m)    en System.Windows.Forms.ContainerControl.WndProc(Message& m)    en System.Windows.Forms.Form.WmShowWindow(Message& m)    en System.Windows.Forms.Form.WndProc(Message& m)    en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    en System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)    en System.Windows.Forms.Control.SetVisibleCore(Boolean value)    en System.Windows.Forms.Form.SetVisibleCore(Boolean value)    en System.Windows.Forms.Control.set_Visible(Boolean value)    en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    en System.Windows.Forms.Application.Run(ApplicationContext context)    en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    en Proyecto_SSER.My.MyApplication.Main(String[] Args) en 17d14f5c-a337-4978-8281-53493378c1071.vb:línea 81    en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)    en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()    en System.Threading.ThreadHelper.ThreadStart_Context(Object state)    en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    en System.Threading.ThreadHelper.ThreadStart()


 


I don't understand anything from the stack trace but maybe its helpful.


Thank you very much!!



Miren, 
  
 I think the reason for this exception is probably that you set wrong MapUnit for your control. Perhaps your data unit should Meter while you still set the DecimalDegrees for it. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


I don’t think so. I’m using decimalDegrees for it because it’s the one I need. In fact, if I try with meters I get another exception of not supported file type in the middle of nowhere.

Miren, 
  
 Could you send us your data that would be very helpful for us to figure out your problem? 
  
 Thanks. 
  
 Yale 


I’m trying to use an InMemoryFeatureLayer getting the data from a database. Now I’m trying with only one point with this coordinates: 
  
 43.3512816971947, -3.00145280763717 
  
 and this are all the code lines I have: 
  
 wmMapa.MapUnit = GeographyUnit.DecimalDegree 
 wmMapa.BackColor = Color.FromArgb(255, 255, 255, 192) 
  
 Dim rect As RectangleShape 
 rect = New RectangleShape(-3.378297, 43.586891, -2.421502, 42.980022) 
 wmMapa.CurrentExtent = rect 
  
         Dim capaPuntos As New InMemoryFeatureLayer() 
         capaPuntos.Open() 
         capaPuntos.Columns.Add(New FeatureSourceColumn(“Nombre”)) 
         capaPuntos.Columns.Add(New FeatureSourceColumn(“IP”)) 
         capaPuntos.Columns.Add(New FeatureSourceColumn(“ID”)) 
         capaPuntos.Columns.Add(New FeatureSourceColumn(“Correcto”)) 
         capaPuntos.Close() 
  
         Dim dictionary As New Dictionary(Of Integer, String)() 
         dictionary.Add(0, directorioApp & "\Imagenes" & descon) 
         dictionary.Add(1, directorioApp & "\Imagenes" & conec) 
         dictionary.Add(2, directorioApp & "\Imagenes" & temper) 
         dictionary.Add(3, directorioApp & "\Imagenes" & entrada) 
         dictionary.Add(4, directorioApp & "\Imagenes" & salida) 
  
         Dim style As New ValueStyle 
         style.ColumnName = “Correcto” 
         For Each item As KeyValuePair(Of Integer, String) In dictionary 
             Dim myStyle As New PointStyle 
             myStyle.PointType = PointType.Bitmap 
             myStyle.Image = New GeoImage(item.Value) 
             style.ValueItems.Add(New ValueItem(item.Key, myStyle)) 
         Next 
  
         capaPuntos.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(style) 
         capaPuntos.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 
  
         For 
             Dim lat As Double            'ALL THIS ARE FILLED FROM THE DB 
             Dim lon As Double 
             Dim nombre As String  
             Dim id As String 
             Dim ip As String 
             Dim correcto As Integer  
             Dim feature As Feature = New Feature(lon, lat, nombre, New String() {“Nombre:” & nombre, “IP:” & ip, “ID:” & id, “Correcto:” & correcto}) 
             capaPuntos.InternalFeatures.Add(id, feature) 
         Next 
  
         Dim overlayPuntos As New LayerOverlay() 
         overlayPuntos.Layers.Add(“PuntosLayer”, capaPuntos) 
  
         wmMapa.Overlays.Add(“puntos”, overlayPuntos) 
  
 wmMapa.Refresh() 
  
  
 Maybe with this data it will be easier for you to find the problem. 
  
 Tank you.

Miren,


I can not recreate your exception, it works you can see my sample according to your supplied code.


You can review the sample I attached, if there is any differences you can tell me.


I use the latest version DesktopEdition, there maybe some bugs in previous version, so let me know your version also will be helpful.


Thanks,


James



1305-InvalidOperationExceptionOnMapRefresh.zip (19.1 KB)

Sorry but I can not open your files. I get an error about some files been moved, I’ll try something to open them. 
  
 In the meantime I let you all the versions of the dll’s: 
 DesktopEdition         3.0.0.0 
 GeoAPI                    1.1.0.0 
 MapSuiteCore          3.0.0.0 
 NetTopologySuite    1.7.3.31740 


Miren, 
  
 I just removed DeskopEdition.DLL and MapSuiteCore.DLL, you can reference your own. 
  
 And the version is not like you see. 
 You should use the statice method WinformMap.GetVersion() to get DesktopEdition’s version, use MapEngine.GetVersion to get MapSuiteCore’s version. 
  
 Hope that can help you! 
  
 James

Hi! I’m sorry, I’ve been out for some days. 
 My verios is: 
 MapSuiteCore 3.1.182 
 DesktopEdition 3.0.362 
  
 anyway, I can’t remember what I did to make it works… and know I have the same problem in other places… It’s always when I’m trying to add an inMemoryFeatureLayer. 
 So… for not been a nuisance, is there any place where I can see the code for adding this to the map and if there is a limit and that stuff… so I canl take a look by my own??? 
  
 Thanks a lot

Miren, 
  
 I test sample by using the DLL version the same as yours, it works. 
  
 If you want to see the code for InMemoryFeatureLayer, we have a sample called “CreateAnInMemoryFeatureLayer” in our HowDoI samples, but it’s quite simple that just show how do I create an InMemoryFeatureLayer, so maybe it’s not which you want. 
  
 And from your code, I am sure that you already know how to add InMemoryFeatureLayer, your way of adding it is quite right. 
  
 InMemoryFeatureLayer has seldom issues, because it’s simple, just like a collection of features stored in memory, so I think maybe something else cause your problem. 
  
 If you still can not fix your problem, please send us a full code sample which can recreate your problem. 
  
 Thanks. 
  
 James

OK Thank you! 
  
 I’ll everything I could and if I still not fixing it I’ll ask again.

Miren, 
  
 You’re welcome. Hope everything will go well soon. 
  
 James

I’ve found an error, at least for this time… 
  
 I was trying to center in a point wich coordinates where out of range (-153248892.0, 43215441353.0)  
  
 Thank you anyway!!!

Miren, 
  
 It’s awesome you find it so quickly! 
  
 Let me know if you have any questions in the future. 
  
 James