AnsweredAssumed Answered

Only the first placemark of KML files being rendered

Question asked by Lunaari on Apr 21, 2019
Latest reply on Apr 26, 2019 by cshi-esristaff

I've spent way too long on this to not seek help. I'm retrieving KML files from SPC Shapefile/KML Links. Every time I draw these files, only the geometry held within the first placemark of the file is added to the KML layer. For reference, these KML files have the following structure:

   Document / Folder (one or two) / Placemarks (multiple)

This is frustrating because through some exploration, I can find the geometry from each KML placemark at the android runtime, but I still can't plot it as a layer. It is also important to note that the first placemark of all the root folders will be drawn. So if there are 2 folders each containing 5 placemarks, I'll get 2 layers added, not 10 like I would prefer.


    protected void onCreate(Bundle savedInstanceState) {
        //SetLicense removed for privacy       
        mMapView = findViewById(;

        Button outlookButton = findViewById(;

        outlookButton.setOnClickListener(v -> {


    private void setupMap() {
        if (mMapView != null) {
            // Get Map Style
            String myLayerId = "9b7f5bb66660427eae788a0a9097c8a8";
            Portal portalService = new Portal("", false);
            PortalItem portalItemLayer = new PortalItem(portalService, myLayerId);

            ArcGISVectorTiledLayer myCustomTileLayer = new
            ArcGISMap map = new ArcGISMap(new Basemap(myCustomTileLayer));

    private void getKmlData(String url) {
        KmlDataset kmlDataset = new KmlDataset(url);
        KmlLayer kmlLayer = new KmlLayer(kmlDataset);
        for (KmlNode node : kmlDataset.getRootNodes()) {
            for (KmlNode subnode : ((KmlDocument) node).getChildNodes()) {
                if(subnode instanceof KmlFolder) {
                    for (KmlNode subsubnode : ((KmlFolder) subnode).getChildNodes()) {
                        if (subsubnode instanceof KmlPlacemark) {

The result is this:

When the desired output should look like this:

As you can see, only the Marginal Risk layer is drawn. The data for the Marginal Risk layer is held in the first placemark in the following file. The General Thunderstorm data is the larger polygon and is contained in the second placemark.

Any help would be greatly appreciated. I've switched back and forth between several APIs regarding this anomaly.