I have a GeoCoding demo application that has been running fine until this morning. All of a sudden I cannot zoom without it lagging and my search "Match" function creates the marker point however the map is shown blank after going to that coordinate.
As I mentioned there were no code changes made since yesterday however it is not working now.
What could cause this issue?
Below is my code for my map configuration.
mapCtrl.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
mapCtrl.MapResizeMode = MapResizeMode.PreserveScaleAndCenter
mapCtrl.MapUnit = GeographyUnit.DecimalDegree
mapCtrl.BackgroundOverlay.BackgroundBrush =
New
GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
mapCtrl.CurrentExtent =
New
RectangleShape(-75.412903, 41.409776, -73.979187, 38.826871)
simpleMarkerOverlay =
New
SimpleMarkerOverlay()
simpleMarkerOverlay.MapControl = mapCtrl
simpleMarkerOverlay.DragMode = MarkerDragMode.Drag
mapCtrl.Overlays.Add(
"WMK"
,
New
WorldMapKitWmsDesktopOverlay())
mapCtrl.Overlays.Add(
"SimpleMarker"
, simpleMarkerOverlay)
mapCtrl.Refresh()
Here is my match function code:
Dim
dataPath
As
String
=
"L:\SQLite_Databases\MapSuiteGeoCoderFullData"
Dim
results
As
System.Collections.ObjectModel.Collection(Of GeocoderMatch)
Dim
usaGeocoder
As
New
UsaGeocoder(dataPath, MatchMode.ExactMatch, StreetNumberMatchingMode.ExactMatch)
Try
usaGeocoder.Open()
If
Me
.txtZipcode.Text.Trim =
""
Then
results = usaGeocoder.Match(
Me
.txtAddress.Text,
Me
.txtCity.Text,
Me
.txtState.Text)
Else
results = usaGeocoder.Match(
Me
.txtAddress.Text,
Me
.txtZipcode.Text)
End
If
Finally
usaGeocoder.Close()
End
Try
simpleMarkerOverlay.Markers.Clear()
mapCtrl.Controls.Clear()
Dim
multiPointShape
As
New
MultipointShape()
Dim
matchString
As
String
=
If
(SearchType = GeocoderSearchType.Street,
"Street"
,
String
.Empty)
Dim
searchResultItems
As
New
System.Collections.ObjectModel.Collection(Of GeocoderMatch)()
Dim
address
As
String
=
Me
.txtAddress.Text
Dim
streetParts()
As
String
= address.Split(
New
Char
() {
" "
c})
Dim
houseNumber
As
Integer
For
Each
housePart
As
String
In
streetParts
If
IsNumeric(housePart)
Then
houseNumber =
CInt
(housePart)
Exit
For
End
If
Next
For
Each
item
As
GeocoderMatch
In
results
If
String
.IsNullOrEmpty(matchString)
OrElse
item.NameValuePairs.ContainsKey(matchString)
Then
If
(item.NameValuePairs(
"CityAlias"
).Trim =
Me
.txtCity.Text.Trim
Or
item.NameValuePairs(
"Zip"
).Trim =
Me
.txtZipcode.Text.Trim)
And
_
((houseNumber >=
CInt
(item.NameValuePairs(
"FromAddressLeft"
))
And
houseNumber <=
CInt
(item.NameValuePairs(
"ToAddressLeft"
)))
And
_
(houseNumber >=
CInt
(item.NameValuePairs(
"FromAddressRight"
))
And
houseNumber <=
CInt
(item.NameValuePairs(
"ToAddressRight"
))))
Then
AddSearchResultMarkerWithToolTip(item, multiPointShape)
searchResultItems.Add(item)
End
If
End
If
Next
UpdateResultListView(searchResultItems)
If
multiPointShape.Points.Count > 0
Then
mapCtrl.CurrentExtent = multiPointShape.GetBoundingBox()
End
If
mapCtrl.Refresh()
and my code to zoom to the found marker point:
Dim
dataGrid
As
DevExpress.XtraGrid.Views.Grid.GridView = TryCast(sender, DevExpress.XtraGrid.Views.Grid.GridView)
Dim
tag
As
BaseShape = BaseShape.CreateShapeFromWellKnownData(TryCast(
Me
.gvResults.GetRowCellValue(e.FocusedRowHandle,
"CentroidPoint"
),
String
))
mapCtrl.CurrentExtent =
DirectCast
(tag, BaseShape).GetBoundingBox()
mapCtrl.Refresh()
Me
.txtLatitude.EditValue = TryCast(
Me
.gvResults.GetRowCellValue(e.FocusedRowHandle,
"FromLatitude"
),
String
)
Me
.txtLongitude.EditValue = TryCast(
Me
.gvResults.GetRowCellValue(e.FocusedRowHandle,
"FromLongitude"
),
String
)
End
Sub
As I mentioned, nothing has changed in my code over the last 24 hours. Could it be an issue with the GeoCoder database indexes?