I can’t display map tiles other than MAPNIK with osmdroid, I want a simplier map

I’m new here, I’m working on a small gps game that display a simple map.
I’m using Kotlin with osmdroid 6.1.18

I successfully displayed a map with MAPNIK as tile source :
MapView.setTileSource(TileSourceFactory.MAPNIK)

MAPNIK map

However, this map display too much information for people to play with.
I want to display a map with only roads and paths (maybe their names, but that’s all !).

So I tried to display other tile sourced maps : HIKEBIKEMAP, OPEN_SEAMAP, PUBLIC_TRANSPORT, etc …
But all of them are blank :

Blank map

I searched in the small FAQ from the GitHub and tried every solutions related to my problem :

  • setting the “user agent”
  • creating a “network_security_config.xml”
  • checking permissions in “AndroidManifest.xml”

But it didn’t change a thing.
So I tried to use the Debug mode from Configuration.getInstance().isDebugMode = true but I’m drowning from the amount of information I get in the Logcat. I don’t know what error is related to my map problem.

I stopped searching with the debug mode and focused on setting the TileSource through URLs like this. But the map still blank, even if I tried different URLs recommended in other stackoverflow’s solutions.
I doubt the URLs links are broken.

I’m out of options and kinda lost, so I’m asking help for just displaying a simplier map !

Here’s my MainActivity :

class MainActivity : ComponentActivity() {
    private val REQUEST_PERMISSIONS_REQUEST_CODE = 1
    private lateinit var map : MapView
    private lateinit var text : TextView
    private lateinit var mapController : IMapController

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Configuration.getInstance().apply {
            userAgentValue = applicationContext.packageName
            load( applicationContext, PreferenceManager.getDefaultSharedPreferences(applicationContext))
            // isDebugMode = true  // DEBUG
        }

        setContentView(R.layout.activity_main)

        // DEBUG TextView
        //text = findViewById(R.id.debugText)
        //Configuration.getInstance().apply {
        //    text.append("cacheMapTileCount : $cacheMapTileCountn" +
        //                "cacheMapTileOvershoot : $cacheMapTileOvershootn")
        //}

        // TILES
        val tileSource: ITileSource = XYTileSource(
            "HOT", 1, 20, 256, ".png", arrayOf(
                "http://a.tile.openstreetmap.fr/",
                "http://b.tile.openstreetmap.fr/",
                "http://c.tile.openstreetmap.fr/"
            ), "© OpenStreetMap contributors"
        )

        // Map creation from Tiles
        map = findViewById(R.id.map)
        map.apply {
            setTileSource(tileSource)
            setBuiltInZoomControls(true)
            overlayManager
        }

        // Start from this point
        val startPoint = GeoPoint(47.9, 1.9)
        mapController = map.controller
        mapController.setZoom(18.0)
        mapController.setCenter(startPoint)

        // Display my location
        // val mLocationOverlay = MyLocationNewOverlay(GpsMyLocationProvider(applicationContext), map)
        // mLocationOverlay.enableMyLocation()
        // map.overlays.add(mLocationOverlay)

        // Display a compass
        // val compassOverlay = CompassOverlay(applicationContext, InternalCompassOrientationProvider(applicationContext), map)
        // compassOverlay.enableCompass()
        // map.overlays.add(compassOverlay)

        // Display lonlat grid
        //val overlay = LatLonGridlineOverlay2()
        //map.overlays.add(overlay)

        // Add map rotation
        // val rotationGestureOverlay = RotationGestureOverlay(map)
        // rotationGestureOverlay.isEnabled
        // map.setMultiTouchControls(true)
        // map.overlays.add(rotationGestureOverlay)

        // Interest point creation
        // var items = mutableListOf<OverlayItem>()
        // var origin = OverlayItem("Statue de Jeanne d'Arc","Héroïne d'Orléans", GeoPoint(47.8,2.0))
        //var draw : Drawable = origin.getMarker(0)
        // items.add(origin)
        // items.add(OverlayItem("3030","Random", GeoPoint(0.1,0.1)))

        // Map listener
        // val listener = object : OnItemGestureListener<OverlayItem> {
        //     override fun onItemSingleTapUp(index : Int, item : OverlayItem): Boolean {
        //         println("MAP : onItemSingleTapUp")  // DEBUG
        //         return true
        //     }

        //     override fun onItemLongPress(index : Int, item : OverlayItem): Boolean {
        //         println("MAP : onItemLongPress")    // DEBUG
        //         return false
        //     }
        // }
        // var mOverlay = ItemizedOverlayWithFocus(applicationContext, items, listener)
        // mOverlay.setFocusItemsOnTap(true)
        // map.overlays.add(mOverlay)

        // Inside your activity
        /*if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
            != PackageManager.PERMISSION_GRANTED) {
            // Permission is not granted, request it
            ActivityCompat.requestPermissions(
                this,
                arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
                MY_PERMISSIONS_REQUEST_LOCATION
            )
        }*/

    }

    override fun onPause() {
        super.onPause()
        map.onPause()
        println("MAP : onPause")  // DEBUG
    }

    override fun onResume() {
        super.onResume()
        map.onResume()
        println("MAP : onResume") // DEBUG
    }

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        val permissionsToRequest = ArrayList<String>()
        var i = 0
        while (i < grantResults.size) {
            permissionsToRequest.add(permissions[i])
            i++
        }
        if (permissionsToRequest.size > 0) {
            ActivityCompat.requestPermissions(
                this,
                permissionsToRequest.toTypedArray(),
                REQUEST_PERMISSIONS_REQUEST_CODE)
        }
    }

}

My permissions from “AndroidManifest” :

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature android:name="android.hardware.location.network" />
    <uses-feature android:name="android.hardware.location.gps" />
    <uses-feature android:name="android.hardware.wifi" />

Thanks all in advance for reading and answering, if you need more information do not hesitate.

New contributor

Dagflot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật