NominatimPOIProvider无法应用于()

时间:2017-09-28 16:00:13

标签: android osmdroid nominatim

NominatimPOIProvider poiProvider = new NominatimPOIProvider();
    ArrayList<POI> pois = poiProvider.getPOICloseTo(startPoint, "cinema", 50, 0.1);
    FolderOverlay poiMarkers = new FolderOverlay(this);
    map.getOverlays().add(poiMarkers);
    Drawable poiIcon = getResources().getDrawable(R.drawable.marker_poi_default);
    for (POI poi:pois){
        Marker poiMarker = new Marker(map);
        poiMarker.setTitle(poi.mType);
        poiMarker.setSnippet(poi.mDescription);
        poiMarker.setPosition(poi.mLocation);
        poiMarker.setIcon(poiIcon);
        if (poi.mThumbnail != null){
            poiMarker.setImage(new BitmapDrawable(poi.mThumbnail));
        }
        poiMarkers.add(poiMarker);
    }

我收到此错误: NominatimPOIProvider中的NominatimPOIProvider(String)无法应用于()

我找到了这个答案,但它没有解决我的问题:OpenStreetMap POIs with Nominatim - error

1 个答案:

答案 0 :(得分:1)

似乎教程已经过时,因为不再有没有NominatimPOIProvider参数的构造函数。您需要指定将在发送给Nominatim服务提供商的标头中使用的用户代理。有关详细信息,请参阅this issueusage policy of openstreetmap

使用类似:

NominatimPOIProvider poiProvider = new NominatimPOIProvider("YourUserAgentSpecificForYourApplicationOrWhatever");