ThinkGeo.com    |     Documentation    |     Premium Support

KML Fails to Load v2

Hi,

This is another issue very similar to this post for which I have no reply.

I am running the following code on the attached kml file.

KmlFeatureLayer kml = new KmlFeatureLayer(filename);
kml.RequireIndex = false;

            kml.Open();
            InMemoryFeatureLayer imfl = new InMemoryFeatureLayer();
            imfl.Name = name;
            foreach (Feature f in kml.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns))
            {
                imfl.InternalFeatures.Add(new Feature(f.GetShape(), f.ColumnValues));
            }
            kml.Close();

I get the following error at the GetAllFeatures call

System.NullReferenceException: ‘Object reference not set to an instance of an object.’

I am using the kml library 10.6.1.

doc.zip (1.1 KB)

Regards,
Damian

hi Damain,

Thanks for the code snippet and the kml file, I reproduced your issue.

I’ve fixed it in the develop branch, could you please upgrade your ThinkGeo.MapSuite.Layers.Kml to
11.0.0-beta021(which should be available in one or two days) and give it a try?

Thanks,
Leo

Thanks Leo.

I will be on the lookout for the update. Does it also fix the issue reported in the KML Fails to load post?

Regards,
Damian

Hi Damian,

No, there’s something wrong with 21US_02170.kml, the line 61 shows as below, there’s no comma between the numbers, it’s not the standard format and we cannot parse it.

<coordinates>-90.4196 27.32</coordinates>

If you add a comma to make it right, everything works fine.

<coordinates>-90.4196,27.32</coordinates>

Thanks,
Leo

Thanks Leo.

New code is working. When will it be pushed to the stable release?

Regards,
Damian

Hi Damian,

ThinkGeo.MapSuite.Layers.Kml 10.6.3 is available now. Feel free to upgrade ThinkGeo.MapSuite.Layers.Kml to 10.6.3 .

Thanks,
Leo