Hello everyone -
I've got some VB.Net code using the MapPoint 11.0 COM Objects that are doing bulk calculations of distances between two points.
Here is the basic workflow:
What I have found, however is that the MapPoint.exe in the Task Manager is consistantly going up, and up in memory useage. As you can see I am trying to set the Map Object to nothing - but it doesnt seem to be solving the problem.Code:m_oApp.PaneState = geoPaneRoutePlanner ' Ensure we're working in miles m_oApp.Units = GeoUnits.geoMiles m_oMap = GetObject(, "MapPoint.Application").ActiveMap m_oMap.Parent.PaneState = geoPaneRoutePlanner m_oRoute = m_oMap.ActiveRoute m_oRoute.Clear() ' Iterate through each row in the data row collection - a row represents an address in the route For Each dr As DataRow In dsRoutePoints Dim oLocation As MapPoint.Location Dim oFindResults As MapPoint.FindResults oFindResults = m_oMap.FindAddressResults(dr.Item("address").ToString, dr.Item("city").ToString, , _ dr.Item("state").ToString, CStr(dr.Item("zipcode")), "United States") If oFindResults.ResultsQuality = GeoFindResultsQuality.geoFirstResultGood Then ' The first address seems to be valid - add the waypoint oLocation = oFindResults(1) m_oRoute.Waypoints.Add(oLocation) Else ... End If Next Try ' Calculate the route m_oRoute.Calculate() Catch ex As Exception ' Only one waypoint in the row collection - cannot calculate a route m_oMap.Saved = True m_oMap = Nothing ReturnResults.ErrorCode = MapPointStructs.CalculateRouteErrors.OnlyOneWaypoint Return ReturnResults Exit Function End Try m_oMap.Saved = True ' No errors occurred - distance calcualted. Return the results ReturnResults.ErrorCode = MapPointStructs.CalculateRouteErrors.NoErrors ReturnResults.DistanceCalculated = m_oRoute.Distance.ToString m_oRoute.Clear() m_oRoute = Nothing Return ReturnResults
Any ideas?
Derek