How to draw a path on a map using kml file?

前端 未结 4 611
温柔的废话
温柔的废话 2020-11-22 01:35

Can I parse kml file in order to display paths or points in Android? Please could you help me with that?

This is kml sample code which I would like to display in and

4条回答
  •  你的背包
    2020-11-22 01:45

    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();
    

提交回复
热议问题