We use the MapSuite 8.0.0 KMLFeatureLayer and KMLFeatureSource to import a KML file as a layer in our application. The KML file is being generated by an open source library called SharpKML. Within the KML file, there is a tag that is defined in the Google KML reference 2.2 as a boolean. The SharpKML library is assigning the values of "true" and "false" as strings for the tag. The xml::Boolean is defined to support values of "true", "false", "0" or "1". It is unclear in the Google KML Reference 2.2 on whether boolean should parse "true" or "false". However, the MapSuite KMLFeatureLayer and KMLFeatureSource definitely does not parse the "true" and "false". The code return an error "Input string is in an invalid format" and aborts the parsing so that the layer is not created.
Should the KMLFeatureLayer, KMLFeatureSource support the values of "true" and "false"? Is there any way to enhance the parser to support these values?
Thanks for any help you can provide.
Richard
KMLFeatureLayer parser does not support boolean values of true,false
Hi,
I tried to replace the “1” or “0” to true and false with our kml files, but I didn’t encounter such exception. would you please send us a simple kml file which can recreate your issue?
Thanks,
Troy
Troy,
Thanks for checking on this so promptly.
The “Extrude” attribute of the “Point” on a “Placemark” is the Boolean that is causing the issue with the string value of “true” and “false”. The parsing aborts as soon as it encounters the “false” in the xml.
I have tried to attach our kml file to this post but the “attachment” process refused to upload a “.kml” file. I have changed the name a few times and I believe I have uploaded the file to attach. You may need to rename the file back to a “.kml” to use it.
Thanks
Richard
kmlplot6.kml.txt (11.3 KB)
kmlplot6.km.txt (11.3 KB)
kmlplot6.kml.test.txt (11.3 KB)
Hi Richard,
Yes, you’re right. I haven’t found the detail description about whether KML support shows booleam value as “true”/“false”, in Google’s documentation, we can just see the value is “0”/“1” in their sample.
But I think for parse exsiting KML, we should can support read “true”/“false”, so I have enhancement that, you can get the enhancement in latest development version 8.0.98.0 or any higher version. (This change haven’t been added to product version now.)
Please let me know whether that works for you.
Regards,
Don
Don,
Thanks for the quick fix.
It seems to work quite well. No more parsing errors and the KML layer is created and shows up. (Not sure if “extrude” works -but I really don’t need to know at this point).
How long does it usually take to get a change like this to the production version build?
Thanks again
Richard
Hi Richard,
In fact we will put the changes to product version when we upgrade version. We need make sure it’s steady.
But this change is not so huge, so if you need this change in product version, please let me know, I can help you move that.
Regards,
Don
Don,
Thanks for the update.
We do not have a huge rush but will be delivering our application next month. It would be nice to include this kml feature so if we could get it into the product version in a week or so it would be great. Other wise, we won’t be needing it for six months or more.
Richard
Hi Richard,
Thanks for let us know that.
Our developer have moved the change to product build.
I think you can find that in 8.0.0.100 or higher version.
Please let me know whether that works there.
Regards,
Don