Search code examples
androidopenstreetmaposmdroid

Nearby places in open street map in android


How can I show the nearby places like police station, restaurant in open street maps . I am using this library to integrate open street map in my android app. The way I integrate this library is following

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Context ctx = getApplicationContext();
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));
    setContentView(R.layout.activity_main);

    MapView map = (MapView) findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
    map.setUseDataConnection(true);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);
    IMapController mapController = map.getController();
    mapController.setZoom(14);
    GeoPoint startPoint = new GeoPoint(48.8583, 2.2944);
    mapController.setCenter(startPoint);
}

Solution

  • You can use osmbonuspack to download nearby POIs via OverpassAPIProvider. For deciding which POIs to download look at OSM's map features and corresponding keys like amenity, shop, leisure and so on.