Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapPoint is null for some reason #10

Open
reachomk opened this issue Jul 2, 2020 · 1 comment
Open

MapPoint is null for some reason #10

reachomk opened this issue Jul 2, 2020 · 1 comment

Comments

@reachomk
Copy link

reachomk commented Jul 2, 2020

Here is my method:

private void showContacts() {
    String endpointUrl = "https://nominatim.openstreetmap.org/";
    for(Contact c: contactList) {
        Address address = c.getAddress();
        if(address != null) {
            MapPoint mapPoint = NominatimAPI.with(endpointUrl).getMapPointFromAddress(address, 5);
            Log.e(c.getName(), mapPoint.getLatitude() + ", " + mapPoint.getLongitude());
        }
        else Log.e("Error", "address null");
    }
}

Error:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Double com.atlis.location.model.impl.MapPoint.getLatitude()' on a null object reference at com.reachomk.contacthome.MapsActivity.showContacts(MapsActivity.java:234) at com.reachomk.contacthome.MapsActivity.getContacts(MapsActivity.java:225) at com.reachomk.contacthome.MapsActivity.onMapReady(MapsActivity.java:95) at com.google.android.gms.maps.zzak.zza(Unknown Source:2) at com.google.android.gms.maps.internal.zzaq.dispatchTransaction(Unknown Source:12) at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source:12) at android.os.Binder.transact(Binder.java:667) at dc.b(:com.google.android.gms.dynamite_mapsdynamite@202117068@20.21.17 (100700-0):2) at com.google.maps.api.android.lib6.impl.be.run(:com.google.android.gms.dynamite_mapsdynamite@202117068@20.21.17 (100700-0):2) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

@eckad158
Copy link

eckad158 commented Oct 6, 2020

I do have the same problem. The MapPoint is always null, the log4j output always gives me the following Message:
NominatimAPI:160 - geocoding response wasn't good enoungh null

I used it with the following (randomly chosen) input adress:

Address newOne = new Address(); newOne.setCountryCode("de"); newOne.setPostcode("28195"); newOne.setCity("Bremen"); newOne.setStreet("Teerhof"); newOne.setHousenumber("59");

Could it be that the API is somehow broken ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants