В некоторых случаях я не получил правильных результатов для форвардного геокодирования. Когда я ищу некоторые места или гостиницу, он показывает результат некоторых других мест или районов. У меня есть следующий код. Я изучаю следующие link. Какой url я должен разместить, чтобы получить правильные результаты.Вперед геокодирование не дает правильных результатов
как мы можем реализовать следующие приведены в следующем сайте
https://developers.google.com/places/webservice/autocomplete
Запрос на поиск адресов, содержащих «Vict» с результатами на французском языке:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=geocode&language=fr&key=API_KEY Запрос на городах, содержащих " Vict "с результатами в Бразилии Португальский:
я реализовал следующие, но это не дает результатов, как я аспектированы
- (CLLocationCoordinate2D)addressLocation{
NSError *error = nil;
// NSString *lookUpString = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?address=%@&sensor=true", SearchtextField];
// NSString *[email protected]"AIzaSyB27SkGBzvEYKcxvZ5nmOVWvrA-6Xqf-7A";
NSString *[email protected]"AIzaSyCHcqJcqZbP1XpU-WB4VfRct5hpdgqisSY";
NSString *lookUpString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/geocode/json?address=%@®ion=np&key=%@", SearchtextField,API_KEY];
lookUpString = [lookUpString stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSData *jsonResponse = [NSData dataWithContentsOfURL:[NSURL URLWithString:lookUpString]];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonResponse options:kNilOptions error:&error];
NSArray *locationArray = [[[jsonDict valueForKey:@"results"] valueForKey:@"geometry"] valueForKey:@"location"];
NSString *statusString = [jsonDict valueForKey:@"status"];
if ([statusString isEqualToString:@"OK"])
{
locationArray = [locationArray objectAtIndex:0];
Str_Latitude= [locationArray valueForKey:@"lat"];
Str_Longitude= [locationArray valueForKey:@"lng"];
NSLog(@"LatitudeString:%@ & LongitudeString:%@", Str_Latitude, Str_Longitude);
/*Google place latitude Longitude*/
Arr_LatLong = @[Str_Latitude,Str_Longitude];
[[NSUserDefaults standardUserDefaults] setValue:Str_Latitude forKey:@"Str_Latitude"];
[[NSUserDefaults standardUserDefaults] setValue:Str_Longitude forKey:@"Str_Longitude"];
[[NSUserDefaults standardUserDefaults] synchronize];
GogLatitude = [Str_Latitude doubleValue];
Goglongitude = [Str_Longitude doubleValue];
if (Bool_SearchField) {
[self getGoogleAddress];
Bool_SearchField=FALSE;
}else{
}
}else{
UIAlertView *alertview =[[UIAlertView alloc] initWithTitle:@"Address not found" message:@"make sure you enter a valid address" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertview show];
NSLog(@"Something went wrong, couldn't find address");
[self.tableView reloadData];
}
GogLocation.latitude = GogLatitude;
GogLocation.longitude = Goglongitude;
return GogLocation;
}
Когда я искать radission в
maps.google.com
он показывает, как показано ниже
Но когда я искать в моем приложении она показывает различные места, то, что я ищу
Похоже, что есть некоторая автокоррекция на Картах Google. Означает ли этот фрагмент правильный результат, когда у вас есть правильное написание? – kaho
он просто дает место, но не то, что я получаю. что URL-адрес, чтобы использовать авто правильно, может, пожалуйста, помогите мне –