Import KML in Maps API V2

前端 未结 2 2040
一向
一向 2021-01-13 08:06

I have multiple KML files which are drawn in google earth and contain different routes. Now I\'m trying to display those in my android project with Maps API V2.

Is t

2条回答
  •  暖寄归人
    2021-01-13 08:29

    Just an update on the KML library for Maps API V2 part of the question. There is now a beta available of Google Maps KML Importing Utility.

    It is part of the Google Maps Android API Utility Library. As documented it allows loading KML files from streams

    KmlLayer layer = new KmlLayer(getMap(), kmlInputStream, getApplicationContext());
    

    or local resources

    KmlLayer layer = new KmlLayer(getMap(), R.raw.kmlFile, getApplicationContext());
    

    After you have created a KmlLayer, call addLayerToMap() to add the imported data onto the map.

    layer.addLayerToMap();
    

提交回复
热议问题