'Loading KML file onto Google Map
I tried implementing KML in Google Maps fragment following official documentation (https://developers.google.com/maps/documentation/android-sdk/utility/kml) but it didn't work. There are no errors, map opens but no KML overlay. I know how to load KML from a local file (stored in raw folder), but I'm trying to do the same through URL leading to KML file (stored on GitHub Gist).
Here's the code:
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
try {
InputStream inputStream = new URL("https://gist.githubusercontent.com/...route.kml").openStream();
KmlLayer layer = new KmlLayer(mMap, inputStream, getApplicationContext());
layer.addLayerToMap();
} catch (Exception e) {
e.printStackTrace();
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
