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

Can't get Streetaddress from FindResults

This is a discussion on Can't get Streetaddress from FindResults within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello my friends, I try to get address information from a specific location, but somehow when I interate through all ...

  1. #1
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    Can't get Streetaddress from FindResults

    Hello my friends,

    I try to get address information from a specific location, but somehow when I interate through all the objects getting from the Findresults I can't get a StreetAddress object. I programmed it as follows:
    Code:
    public string GetAddressInfo(Location loc)
            {
                StreetAddress streetaddress;
                FindResults results = m_MainMap.ObjectsFromPoint(m_MainMap.LocationToX(loc), m_MainMap.LocationToY(loc));
                if(results.ResultsQuality == GeoFindResultsQuality.geoNoResults)
                    return "no info available";
    
                foreach(object o in results)
                {
                    if (o is StreetAddress)
                    {
                        streetaddress = (StreetAddress)o;
                        string street = "Street: " + streetaddress.Street + " ";
                        string number = streetaddress.Value + ", ";
                        string city = "City: " + streetaddress.City + ", ";
                        string postcode = "Postalcode: " + streetaddress.PostalCode;
    
                        return street + number + city + postcode;
                    }
    
                }
                return "no info available";
            }
    I wrote my application in C++ now I'm rewriting it in C#.
    Is there something wrong in my code?
    Thank you!

  2. #2
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    Re: Can't get Streetaddress from FindResults

    I'm sorry for my silly question. I haven't read the manual well, I need to get the StreetAddress object from the Location returned form FindResults.
    Now the code below is working:
    Code:
    public string GetAddressInfo(Location loc)
            {
                StreetAddress streetaddress;
                FindResults results = m_MainMap.ObjectsFromPoint(m_MainMap.LocationToX(loc), m_MainMap.LocationToY(loc));
                if(results.ResultsQuality == GeoFindResultsQuality.geoNoResults)
                    return "no info available";
    
                foreach(object o in results)
                {
                    if (o is Location)
                    {
                        streetaddress = o.StreetAddress;
                        string street = "Street: " + streetaddress.Street + " ";
                        string city = "City: " + streetaddress.City + ", ";
                        string postcode = "Postalcode: " + streetaddress.PostalCode;
    
                        return street + city + postcode;
                    }
    
                }
                return "no info available";
            }

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

    Re: Can't get Streetaddress from FindResults

    Hi,

    good that it works and thanks for feedback

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Location. StreetAddress is nothing
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-19-2004, 04:36 PM
  2. [HELP]: Problem with C# and FindResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-27-2004, 02:51 AM
  3. How do you read from a FindResults type in delphi?
    By matt1168 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 02-27-2004, 07:57 AM
  4. oLoc.StreetAddress.Country
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-11-2003, 09:22 AM
  5. OS Grid References - FindResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-14-2002, 03:20 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