ios - Get touch location on map -


i using following code find latitude , longitude of touch location on map-

-(void)handlepressrecognizer:(uigesturerecognizer *)gesturerecognizer {     (pointannotation *ann in [mmapview annotations]) {         if ([ann iskindofclass:[pointannotation class]]) {             [mmapview removeannotation:ann];         }     }     [mmapview removeannotations:[mmapview annotations]];     cgpoint touchpoint = [gesturerecognizer locationinview:mmapview];     cllocationcoordinate2d touchmapcoordinate =     [mmapview convertpoint:touchpoint tocoordinatefromview:gesturerecognizer.view];     if (gpslocation != nil) {         gpslocation = nil;     }     gpslocation = [[cllocation alloc]initwithlatitude:touchmapcoordinate.latitude longitude:touchmapcoordinate.longitude];     [self performselector:@selector(showloadingview) withobject:nil afterdelay:0.001];     [self performselector:@selector(getgoogleaddressfromlocation:) withobject:gpslocation afterdelay:0.1];   } 

and passing these lat/long google api find address google giving me wrong location , address.

here screen shot-

enter image description here

please find out problem.

i used following code google map sdk tap location-

- (void)mapview:(gmsmapview *)mapview didtapatcoordinate:(cllocationcoordinate2d)coordinate {     nslog(@"you tapped @ %f,%f", coordinate.latitude, coordinate.longitude);      [mmapview clear];     gpslocation = [[cllocation alloc]initwithlatitude:coordinate.latitude longitude:coordinate.longitude];  } 

and following code dropping pin on location-

    gmsmarker *marker = [[gmsmarker alloc]init];      marker.title = [responsedict valueforkey:@"address"];     marker.snippet = [responsedict valueforkey:@"country"];     self.addressstring = [responsedict valueforkey:@"address"];     marker.position = gpslocation.coordinate;      marker.map = mmapview;     [mmapview setselectedmarker:marker]; 

with mapkit, google not giving me right tap location google map working charm.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -