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

Problem with parsing countries

This is a discussion on Problem with parsing countries within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I am using MapPoint with C# in a school project. I am trying to do what seems to be ...

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

    Problem with parsing countries

    Hi,

    I am using MapPoint with C# in a school project. I am trying to do what seems to be a fairly simple task; retreiving addresses from a database and drawing them as pins on a MapPoint control.

    I first tried using the FindAddressResults method by supplying Street, City, Postalcode and Country. What happened was that all locations were drawn in Sweden.
    Then I tried creating a StreetAddress object with the same values as above. From that object I used the Country property to get a GeoCountry value to use in the FindAddressResults method. The same thing happened; the GeoCountry object was always geoCountryDefault (which is Sweden in my case), so the search results all turned out the same.

    So how do I parse the country strings properly? Any answers are much appreciated.

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

    Try this one (if this is what you wants, witch I think):
    Code:
                FindResults Results = MP.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);
                if (Results.ResultsQuality == GeoFindResultsQuality.geoFirstResultGood) {
                    object o = 1;
                    Location Loc = (Location)Results.get_Item(ref o);
                    Pushpin PP = MP.ActiveMap.AddPushpin(Loc, "");
                    PP.GoTo();
                }

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thanks Wilfried, but that didn't work. When using that, I got no locations at all, since there were no good results, since the country always got parsed wrong. If I supply a correct street, city and postal code for a German location, but the country is Sweden, the address result is of poor quality.

    The thing is, if I use a code that looks like this:
    Code:
    FindResults Results = MP.ActiveMap.FindAddressResults("A street", "A city", "Other city", "Region", "Postal code", "Germany");
    (assume that all attributes point to an existing address)

    I want the result to be the same as in:
    Code:
    FindResults Results = MP.ActiveMap.FindAddressResults("A street", "A city", "Other city", "Region", "Postal code", GeoCountry.geoCountryGermany);
    Note that the country is the only different thing in the two examples. However, the method doesn't understand that "Germany" as a string object is the same thing as GeoCountry.geoCountryGermany.

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

    Quote Originally Posted by Anonymous
    If I supply a correct street, city and postal code for a German location, but the country is Sweden, the address result is of poor quality.
    I dont understeand wy you want to give an adress in the one country while specifying another country ? If I give my streetaddress which is in Belgium and I specify eg Germany I dont think I get good results eather. If I misunderstood then please reprase your question.

    Quote Originally Posted by Anonymous
    FindResults Results = MP.ActiveMap.FindAddressResults("A street", "A city", "Other city", "Region", "Postal code", "Germany");
    This will not compile since the country is not of type string but a type GeoCountry.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Quote Originally Posted by Wilfried
    Quote Originally Posted by SwedishStudent
    FindResults Results = MP.ActiveMap.FindAddressResults("A street", "A city", "Other city", "Region", "Postal code", "Germany");
    This will not compile since the country is not of type string but a type GeoCountry.
    Ok, so there is no way to automatically parse country names as strings into FindAddressResults? That makes it kind of difficult, since I have a rather long list of addresses which I need to find on a map.

    The only thing that comes to mind is manually comparing the country strings with the GeoCountry values. This is weird, since I've heard from other sources that the FindAddressResults method actually can parse strings where the country value is supposed to be.

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

    there is a method that accept complete address strings (check one of my postings of today) but I forgot witch one

    But you can do easey fast case statement to check GE, SW etc to the geoCountry value. I dont think this can be of any problem.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Which countries are supported?
    By Rick in forum Bing Maps and MapPoint Web Service
    Replies: 0
    Last Post: 04-17-2006, 12:56 PM
  2. Work with data of Baltic countries, Balcan countries, Greece
    By Abilio Serafim in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-17-2005, 12:20 PM
  3. Not supported countries
    By marco66 in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-19-2005, 09:22 AM
  4. Gray other countries
    By dynek in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 01-11-2005, 09:48 AM
  5. delete countries
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-19-2002, 11:59 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