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 7 of 7

C# FindNearby

This is a discussion on C# FindNearby within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello, I use the FindNearby fuction in a C# program to determine the nearest street to a position given by ...

  1. #1
    MD2000 is offline Member Yellow Belt
    Join Date
    Feb 2005
    Posts
    32

    C# FindNearby

    Hello,
    I use the FindNearby fuction in a C# program to determine the nearest street to a position given by latitude/longitude. I have the following problem: the returned FindResult can contain Location and Pushpin objects. How can I find out the type of each element in the FindResult? It seems to me they are all of the type ComObject. I'm just trying to find out the nearest street.

    Bye,

    MD

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Code:
                FindResults Nearby = PP.Location.FindNearby(10);
                foreach (object o in Nearby) {
                    if (o is Pushpin)
                        // this is a pushpin
                    else if (o is Location)
                        // this is a Location
    If you only need Location and dont need any other you can do following:

    Code:
                FindResults Nearby = PP.Location.FindNearby(10);
                foreach (object o in Nearby) {
                    Location loc =  o as Location
                    if (o != null) {
                        // voila !

  3. #3
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: C# FindNearby

    Hi,

    Quote Originally Posted by MD2000
    I'm just trying to find out the nearest street.
    FindNearest only give you "points of interest", so no streets. But of course these points of interest have a streetaddress in many case.

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    FindNearest only give you "points of interest", so no streets. But of course these points of interest have a streetaddress in many case.


    In many cases?

    Hmmm, I'm having problems here with FindNearby. I was using it fine, but when you ask for the nearest ATMs within 20 miles say, it isn't much use if a dozen of them are all called "Bank of America". I need some (human) way to distinguish them, eg. street address. At the moment I'm finding StreetAddress is nothing.

    Let me see how many are affected, it was looking like all of them a few minutes ago, though...


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  5. #5
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    Looks like you're right Wilfried. Virtually all the POIs I've tried in the Dallas area have street information. A handful don't - just enough to crash my program unless I check the StreetAddress property for null/nothing!


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Richard,

    A handful don't - just enough to crash my program unless I check the StreetAddress property for null/nothing!
    Yes indeed the null checking filters them out. Is there something you like me to test/help on this ?

  7. #7
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    No I'm fine Wilfried. I was adding my own code to my own program and found it crashing. It is one more thing to check, but at least the data is there in most cases - which I think is enough for this customer.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindNearby or QueryCircle
    By RickS in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-27-2005, 10:53 AM
  2. Problem or Bug using FindNearby
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-13-2004, 01:05 PM
  3. FindNearby problem
    By webjagger in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-25-2004, 06:56 AM
  4. Help with FindNearby
    By BobIDEAS in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-30-2003, 11:17 PM
  5. FindNearby Method
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-24-2002, 10:08 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