V
V
Vadim Popov2018-10-16 12:29:33
Android
Vadim Popov, 2018-10-16 12:29:33

How to add Placemark to yandexmapkit using vector drawable as image resource?

Good afternoon everyone, I'm using yandex mapkit 3.0, I'm trying to add a vector drawable icon

mapView.getMap().getMapObjects().addPlacemark(new Point(geoPosition.getLatitude(), geoPosition.getLongitude()), ImageProvider.fromResource(this, R.drawable.ic_geolocation));

The image is not displayed, if you use as a png icon, then everything is fine
mapView.getMap().getMapObjects().addPlacemark(new Point(geoPosition.getLatitude(), geoPosition.getLongitude()), ImageProvider.fromResource(this, R.drawable.somePng));

mapkit from Yandex does not support this version of images for labels? Logcat doesn't throw any errors.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Toxu4, 2020-07-27
@vadimpopov94

If still relevant:

private fun drawMyLocationMark(it: MyLocation) {
        val view = View(requireContext()).apply {
            background = requireContext().getDrawable(R.drawable.ic_place_24px)
        }

        mapview.map.mapObjects.addPlacemark(
            Point(it.latitude, it.longitude),
            ViewProvider(view)
        )
    }

MyLocation - data class with coordinates
R.drawable.ic_place_24px - svg drawable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question