MapWindow / MapWinGIS

MapWinGIS.ocx is a FREE and OPEN SOURCE C++ based geographic information system programming ActiveX Control and application programmer interface (API) that can be added to a Windows Form in Visual Basic, C#, Delphi, or other languages that support ActiveX, providing your app with a map. Go to our forum for questions and help:
https://mapwindow.discourse.group/
Mozilla Public License 2.0
269 stars 134 forks source link

Crash while zoom with mouse wheel #59

Closed jacksonmacd closed 5 years ago

jacksonmacd commented 6 years ago

Paul - downloaded and installed 4.9.5 for my desktop application using MSAccess 32-bit (2003/2010) under Windows 10. Much more stable than 4.9.4. Thanks very much for your (and developers) work. Still not 100%, though. It crashed Access several times, and I've isolated the problem to the mouse zoom wheel when viewing an area of the map that may not have been cached locally at the chosen zoom scale. (Using OpenStreetMaps background) This (admittedly contrived) process crashed it almost every time. 1) Zoom out to view all of North America 2) zoom into an area that hasn't been visited before (sometimes this is enough to crash at higher zoom levels) 3) back out by three zoom levels, especially if you zoom quickly with the mouse wheel. I only use this application sporadically, and it was a real exercise in frustration with zoom and pan when I last used it under 4.9.4 because of continual crashes. Version 4.9.5 looks much better, and I am looking forward to the next time when I need to run the program.

pmeems commented 6 years ago

I just tried this with the unit test project which is included in the source code of MapWinGIS: (https://github.com/MapWindow/MapWinGIS/tree/master/unittests). I zoomed out to the world, moved to central Africa and zoomed in several times using the mouse wheel. I can't reproduce it. No crash, tiles are fetched.

Perhaps you can show me your code for setting up the tiles? I only use these few lines:

_axMap1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR;
_axMap1.KnownExtents = tkKnownExtents.keNetherlands;
_axMap1.ZoomBehavior = tkZoomBehavior.zbUseTileLevels;
_axMap1.Tiles.Provider = tkTileProvider.OpenStreetMap;
jacksonmacd commented 6 years ago

Paul Thanks for the reply. I opened the map again, and tried mousing and zooming to recreate the problem. It went about 5 minutes of pan/zoom without a crash, and I thought it was my imagination that I had experienced any problem. Then one crash happened.

So I reloaded the application and map, and tried again. This time the crash came sooner. After several repetitions of crash/reload, it came to a point where it crashed quite frequently. As before, it seemed to be related to zoom way out, zoom in to the the maximum magnification, and then zoom out several levels.

Here is the code from my VBA application. The "ConfigureOfflineMaps" routine is executed when the map is loaded.

Private Sub Form_Load() Dim gs As New GlobalSettings Dim iLayerHandle As Integer

gs.ApplicationCallback = New MwCallback
chkOfflineMaps = GetSetting(APPLICATIONNAME, "General", "OfflineMaps", 0)

With axMap
    .TileProvider = tkTileProvider.OpenStreetMap
    .Projection = tkMapProjection.PROJECTION_WGS84
    .ShowVersionNumber = True
    .ShowRedrawTime = True
    .ShowCoordinates = True

    .CursorMode = 3
    .SendSelectBoxDrag = True
End With
If chkOfflineMaps Then ConfigureOfflineMaps

'first GPS point in each session
iLayerHandle = CreateBasicLayer("Waypoints", "ConsolidatedID ", "FROM qryGPSTableSELECTED ", _
    "WHERE Not isnull(Waypoint) ", 15, RGB(0, 0, 255), 0, "Waypoint")
iLayerHandle = CreateBasicLayer("FirstGPSPoint", "Min(ConsolidatedID) ", "FROM qryGPSTableSELECTED ", _
    "WHERE Not IsNull(Lat) and NOT IsNull(Long) GROUP BY SessionIDfk ", 9, RGB(160, 70, 200), 3)

iLayerHandle = CreateGPSShapefile(6, RGB(0, 0, 255), 3)

End Sub

Private Sub ConfigureOfflineMaps() Dim sFilename As String Dim sPathname As String

With axMap.Tiles
     .DoCaching(tkCacheType.Disk) = True
     .DoCaching(tkCacheType.RAM) = False
     dhParsePath CurrentDb.Name, sPathname, sFilename
     .DiskCacheFilename = sPathname & "\" & APPLICATIONNAME & ".db3"  ' dynamic, to this project
     .MaxCacheSize(tkCacheType.Disk) = 500
End With

End Sub

I noticed that my code omits .KnownExtents and .ZoomExtents, so I added them, but still had the same crash problem. Can't recall the details of why I included all the other stuff that you omitted, but it was probably my "best guess" after experimentation.

Please don't misunderstand. My intent is not to nag about potential bugs. The problem may well be that MS Access 2003 is just too old to be a reliable host. It's not critical for me to get to the root cause, but I will continue experimenting if it benefits you and the project. The map is way more stable than it was a year ago.

IndustryRU commented 5 years ago

Good day! Same problem. MS Access 2016 x64 and MapWinGis 4.9.6.1

pmeems commented 5 years ago

Is this still a problem with the latest version of MapWinGIS?

I'm closing this issue. If needed you can repost at our MapWinGIS forum

defactoalok commented 2 years ago

Hi, I am really impressed with Mapwingis. But I am facing the same issue as above, the moment I change the Projection to WGS84 the application crashes after a couple of seconds. I am tying to display 4 shape files on openstreetmap using c# with latest Mapwingis and Visual Studio 2022. Pleasae help. Regards Alok

jacksonmacd commented 2 years ago

I haven't used MapWindow for several years. The issue remains unsolved for me.

On Mon, May 23, 2022 at 10:57 PM defactoalok @.***> wrote:

Hi, I am really impressed with Mapwingis. But I am facing the same issue as above, the moment I change the Projection to WGS84 the application crashes after a couple of seconds. I am tying to display 4 shape files on openstreetmap using c# with latest Mapwingis and Visual Studio 2022. Pleasae help. Regards Alok

— Reply to this email directly, view it on GitHub https://github.com/MapWindow/MapWinGIS/issues/59#issuecomment-1135443336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKTPL7EJI2GVTWNR5K5P3DVLRVV3ANCNFSM4EJ5CKCA . You are receiving this because you authored the thread.Message ID: @.***>

--

Jack