Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

Nearest pushpins

This is a discussion on Nearest pushpins within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I have imported 48 pushpins into a map. When I scroll over one of the pushpins, I want the ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Nearest pushpins

    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.

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Use MouseMove event

    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

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding nearest pushpins in dataset
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-17-2003, 09:38 AM
  2. find nearest locality
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-09-2003, 04:26 AM
  3. nearest city of a point
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 04-07-2003, 07:46 AM
  4. How to find nearest city?
    By Petr Brant in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 08-23-2002, 02:49 PM
  5. how is the possibility to know the nearest route (....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-20-2001, 04:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96