iOS Question Geo location return wrong results

Shay

Well-Known Member
Licensed User
Hi

I will have to write some data in hebrew due to hebrew street names
I am using ilocation 1.20

and the following code to send street and city name in order to get lat,lon
B4X:
Dim LocationName As String
    'LocationName= Main.Street & " " & Main.Number & " , " & Main.City & " , ישראל"
    LocationName= Main.City & " "  & Main.Number & " " & Main.Street
    Geocoder1.ResolveAddress(LocationName)
(as you can see I tried both ways to send the street name / city name)
in both the results are wrong

my city that I am entering: "פתח תקווה" which is first difference from Android since there I am putting "פתח תקוה" and here it require me to put double "ו" or it gives error
(I tried in andoid double "ו" and it gives correct answer on both cases (1 or 2 vav)

street:"ארלוזורוב"
number: "20"

the results that I am getting is from 2 different cities: see below:
(which missing street name)

פתח תקווה 20, נתניה, ישראל @ <+32.32377790,+34.86042210> +/- 100.00m, region CLCircularRegion (identifier:'<+32.32377790,+34.86042210> radius 49.93', center:<+32.32377790,+34.86042210>, radius:49.93m)

פתח תקווה 20, הרצליה, ישראל @ <+32.15982600,+34.85057210> +/- 100.00m, region CLCircularRegion (identifier:'<+32.15982600,+34.85057210> radius 49.93', center:<+32.15982600,+34.85057210>, radius:49.93m)

and this is the coordinate I am getting
32.3237779, 34.8604221

I check via http://www.latlong.net/
the results from the web site is correct on many ways I tried it, which is:
32.084935, 34.875742
 

Shay

Well-Known Member
Licensed User
Can you check my example and see the difference between B4A and B4i
are they both use the same resource for GEO (maybe you need to make it as b4a)
clearly there is a bug here.
Can you please investigate, this is blocker to my app
 

Shay

Well-Known Member
Licensed User
1. Is there a web site apple gives to check such issues (meaning to enter street / city and see what you get)
2. Can you try it based on my example, to see we have issue here
3. How can I (or you) open bug at Apple?
4. in the meanwhile is there other way to get the geo data (maybe using some http request to web site)
 

Erel

Administrator
Staff member
Licensed User

Shay

Well-Known Member
Licensed User
To replicate just run:
B4X:
Geocoder1.Initialize("Geocoder1")
    Geocoder1.ResolveAddress("ארלוזורוב 20 פתח תקווה")
B4X:
Sub Geocoder1_Complete (Success As Boolean, Placemarks As List)
    If Success Then
        Dim Address As Placemark
        Dim i As Int
        For i=0 To Placemarks.Size-1
            Address=Placemarks.Get(i)
            Log(Address)
            Log("("&Address.lat&", "&Address.Lng&")")
        Next
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
OBJ is an object of type CLGeocoder *.
B4X:
- (void)ResolveAddress:(NSString *)Address {
  [OBJ geocodeAddressString:Address completionHandler:^(NSArray *placemark, NSError *error){
  B4IList *p = [B4IList new];
  [p Initialize];
  if (placemark == nil) {
  [B4I shared].lastError = error;
  } else {
  [(NSMutableArray *) p.object addObjectsFromArray:placemark];
  }
  [B4IObjectWrapper raiseEvent:OBJ :@"_complete::" :@[@(placemark != nil), p]];
  }];
}
As I previously wrote it is not a bug in iLocation library. The code just calls the native geocodeAddressString method.
 
Last edited:

Shay

Well-Known Member
Licensed User
bug opened at apple
#20137377
for now I am using google geo service, which gives correct results
 
Top