OpenStreetMap POIs with Nominatim - error

∥☆過路亽.° 提交于 2019-12-12 04:31:54

问题


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"


回答1:


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");



回答2:


resolved with:

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


来源:https://stackoverflow.com/questions/39977322/openstreetmap-pois-with-nominatim-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!