Nearest pushpins

Anonymous
01-04-2004, 04:13 AM
Hi, I have imported 48 pushpins into a map. When I scroll over one of the pushpins, I want the map to highlight the nearest 10 (a variable number) pushpins, can anyboy give me any clues where to start.

Anonymous
01-06-2004, 11:04 AM
Hi,
Write a MouseMove event handler, from this you can get lat.long from that you can query your pushpins and from there you could change symbols for the nearest 10 therfore highlighting them

Hope this helps.

Scarr

Anonymous
01-07-2004, 06:57 AM
Try something like:

Function HighlightClosest(oDataset As MapPoint.DataSet, oCentre As MapPoint.Location, rlngCount As Long)

Dim rs As MapPoint.Recordset
Dim lngRecordCount As Long
Dim Radius As Double

Const INCREMENT = 0.1
Const MAX_RADIUS = 1

On Error GoTo HC_Error

Radius = 0

Do
Radius = Radius + INCREMENT
Set rs = oDataset.QueryCircle(oCentre, Radius)
lngRecordCount = 0
rs.MoveFirst
If Not rs.EOF Then
Do
rs.Pushpin.Highlight = True
lngRecordCount = lngRecordCount + 1
rs.MoveNext
Loop While Not rs.EOF
End If
Set rs = Nothing
Loop While Radius < MAX_RADIUS And lngRecordCount < rlngCount
HC_Exit:
Exit Function
HC_Error:
Debug.Print Err.Description
Resume HC_Exit
End Function


You will also need something to whizz round and remove the highlights when you no longer want them. You will also need to adjust the MAX_RADIUS and INCREMENT to suit your data

BTW wouldn't recommend using MouseMove event, especially if you are using large datasets.


HTH

M.

 
Web mp2kmag.com
mapforums.com