SilverBlue
SilverBlue

Reputation: 269

OpenStreetMap POIs with Nominatim - error

I'm using this tutorial: https://github.com/MKergall/osmbonuspack/wiki/Tutorial_2

I set this Code in my Project:

NominatimPOIProvider poiProvider = new NominatimPOIProvider();
ArrayList<POI> pois = poiProvider.getPOICloseTo(startPoint, "cinema", 50, 0.1);

But I get some Errors:
NominatimPOIProvider (String) in NominatimPOIProvider cannot be applied to ()

and

java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Request$Builder; at org.osmdroid.bonuspack.utils.HttpConnection.doGet(HttpConnection.java:65) at org.osmdroid.bonuspack.utils.BonusPackHelper.requestStringFromUrl(BonusPackHelper.java:70) at org.osmdroid.bonuspack.location.NominatimPOIProvider.getThem(NominatimPOIProvider.java:83) at org.osmdroid.bonuspack.location.NominatimPOIProvider.getPOICloseTo(NominatimPOIProvider.java:133) at x.x.UserArea.onCreate(UserArea.java:152) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) at android.app.ActivityThread.access$1100(ActivityThread.java:222) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7229) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.Request$Builder"

Upvotes: 0

Views: 257

Answers (2)

Josef Adamcik
Josef Adamcik

Reputation: 5780

Error:

NominatimPOIProvider (String) in NominatimPOIProvider cannot be applied to ()

is caused by an absence of nonparametric constructor for NominatimPOIProvider. You are required to specify user agent which will be used in headers sent to a Nominatim service provider. More details can be found in this issue and in usage policy of openstreetmap.

Use something like:

NominatimPOIProvider poiProvider = new NominatimPOIProvider("YourUserAgentSpecificForYourApplicationOrWhatever");

Upvotes: 1

SilverBlue
SilverBlue

Reputation: 269

resolved with:

compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
compile 'com.squareup.okhttp3:okhttp:3.2.0'

Upvotes: 0

Related Questions