| | Anonymous 01-09-2005, 08:09 AM 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. Wilfried 01-09-2005, 12:12 PM Hi,
Try this one (if this is what you wants, witch I think):
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();
} Anonymous 01-09-2005, 02:35 PM 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:
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:
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. Wilfried 01-10-2005, 02:33 AM Hi,
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.
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. Anonymous 01-10-2005, 09:49 AM 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. Wilfried 01-10-2005, 01:41 PM 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. | |