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

How to get the Best Matched Address from FindAddressResults.

This is a discussion on How to get the Best Matched Address from FindAddressResults. within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I am using the method FindAddressResults of MapPoint object to find some address results in a map file. When ...

  1. #1
    gvkreddy is offline Junior Member White Belt
    Join Date
    Nov 2004
    Posts
    6

    How to get the Best Matched Address from FindAddressResults.

    Hi,

    I am using the method FindAddressResults of MapPoint object to find some address results in a map file.
    When I use the same, it returns me some abiguous results.
    I would like to get the best matched one out of the ambiguous results.

    I am not sure how to get the best matched location from the results object.

    Any pointer / information is much appreciated.
    Thanks & Regards,
    Vijay

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

    I dont know if this is what you looking for but the collection returned from FindAddressResults has a property named ResultsQuality. It can have following values:
    Code:
        public enum GeoFindResultsQuality
        {
            geoAllResultsValid = 0,
            geoFirstResultGood = 1,
            geoAmbiguousResults = 2,
            geoNoGoodResult = 3,
            geoNoResults = 4,
        }
    Another possible is that you look for a specific object type in the collection because it can contain different types. For example if you onle need to find the Location objects you can do something like this:
    Code:
                foreach (object o in Results) {
                    Location Loc = o as Location;
    
                    if (Loc != null) {
                        //here you go
                    }
                }
    or you can combine the 2 and first check if the ResultsQuality <= geoAmbiguousResults and then loop with the foreach();

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    I would like to be more specific.

    1> I get the matched addresses using findaddressresults method
    2> This returns me the Results object having the ambiguous results.
    Among these results I would like to get the closest match to my address.

    Suppose if I pass

    FindAddressResults("","New York", "", "NY", "", "US");

    I must get the location which is center of New York.

    I hope I am clear.

    Vijay

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

    Quote Originally Posted by Anonymous
    FindAddressResults("","New York", "", "NY", "", "US");

    I must get the location which is center of New York.
    Note that country is not string but Geocountry type. I dont know about the short form "NY" if mappoint will recognize it, but this is probably not importand.

    Anyway I just tryed that first with only a ZIP code, and then with only a city name, and it returns exact the center of the city as you wanted

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

    Any idea how to convert given address string into a location object with out using the find, findresults , findaddressresults mehtods.

    Actually, I have an address string,

    I would like to get the all pushpins with in specified radius from this location.


    Vijay

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

    Maybe is FindPlaceResults the method you wnat ? It accepts a string like: "Washington, D.C." but I never tryed it. To find opjects near by you can try the FindNearBy method.

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Code:
    oResults=oMap.FindAddressResults&#40;@street,@city,"" ,@state, @zip, @country&#41;;
    				string resQuality=oResults.ResultsQuality.ToString&#40;&#41;;
    				if&#40; resQuality== "geoFirstResultGood" || resQuality=="geoAmbiguousResults"&#41;
    				&#123;
    					foreach &#40;object o in oResults&#41;
    					&#123;
    						MapPoint.Location oLoc =o as MapPoint.Location;
    						if&#40;oLoc!=null&#41;
    						&#123;
    							// oDataset is mappoint Dataset holding the Counsellors.				                                          oRs=oDataSet.QueryCircle&#40;oLoc, radius&#41;;
    							if&#40;oRs!=null&#41;
    							&#123;
    								oRs.MoveFirst&#40;&#41;;
    								while&#40;!oRs.EOF &#41;
    								&#123;
    									oPin=oRs.Pushpin;
    									if&#40;oPin !=null&#41;
    										counselCount=counselCount+1;
    									oRs.MoveNext&#40;&#41;; 
    								&#125;
    							&#125;
    							//break;
    						&#125;
    					&#125;
    					return counselCount;
    I am using the above code to get the Pushpins from.

    When i try to use my MapPoint application, chose the New York city and if I use the MapPoint Application on my system it gives me nearly 22 counsellors(Puspin) in 50 miles of radius,

    But when I execute the above program, it gives me just 5 Counsellors(Puspin).

    I am not able to understand where am going wrong.

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

    ResultsQuality can also be: geoAllResultsValid. I suggest you do not use a string to compare (it is also slower) but like this:

    Code:
                if &#40;Results.ResultsQuality <= GeoFindResultsQuality.geoAmbiguousResults&#41; &#123;

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thank you very much..

    I will make necessary changes and get back to you.

    Vijay

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindAddressResults returns nothing
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 12-07-2004, 05:23 AM
  2. Problem with FindAddressResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-01-2004, 10:04 AM
  3. FindAddressResults not always working?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-10-2003, 06:25 AM
  4. Exporting an address matched file
    By bob everett in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-27-2003, 07:30 PM
  5. Need help about the FindAddressResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 08-21-2002, 08:51 PM

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