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

前端 未结 4 613
温柔的废话
温柔的废话 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:58

    Mathias Lin code working beautifully. However, you might want to consider changing this part inside drawPath method:

     if (lngLat.length >= 2 && gp1.getLatitudeE6() > 0 && gp1.getLongitudeE6() > 0
                        && gp2.getLatitudeE6() > 0 && gp2.getLongitudeE6() > 0) {
    

    GeoPoint can be less than zero as well, I switch mine to:

         if (lngLat.length >= 2 && gp1.getLatitudeE6() != 0 && gp1.getLongitudeE6() != 0
                        && gp2.getLatitudeE6() != 0 && gp2.getLongitudeE6() != 0) {
    

    Thank you :D

提交回复
热议问题