php-libkml icon indicating copy to clipboard operation
php-libkml copied to clipboard

Partial conversion of KML files with MultiGeometry to GeoJSON + missing conversion of ExtendedData

Open alexboss opened this issue 9 years ago • 0 comments

Dear @earelin,

Thank you for this library which is really useful for KML conversion to GeoJSON.

I'd like to inform you that the conversion of KML files with MultiGeometry to GeoJSON doesn't work.

For instance, if you convert the following KML files with MultiGeometry points_shapes.kml.txt using the method toExtGeoJSON you'll get a file without the polygons of the MultiGeometry points_shapes_converted_phplibkml.geojson.txt.

Meanwhile GeoJSON.io converts it correctly points_shapes_converted_geojsonio.geojson.txt

If you send the file points_shapes.kml.txt to the test/parse.php you'll get the following fatal error:

Fatal error: Cannot call abstract method libKML\KMLObject::__toString() in /path/to/php-libkml_v0.1/libKML/geometries/MultiGeometry.php on line 51
Call Stack
#	Time	Memory	Function	Location
1	0.0007	320280	{main}( )	.../parse.php:0
2	0.0518	2672032	KML->__toString( )	.../parse.php:106
3	0.0518	2673152	libKML\Document->__toString( )	.../libkml.php:127
4	0.0518	2673224	libKML\Container->__toString( )	.../Document.php:13
5	0.0530	2684880	libKML\Placemark->__toString( )	.../Container.php:71
6	0.0530	2685800	libKML\MultiGeometry->__toString( )	.../Placemark.php:22

Also, Name and Description tags are correctly converted, but I have the felling that ExtendedData are not (for instance they are missing when converted to GeoJSON).

Thanks a lot for your help,

Kind regards,

Alexandre 8)

alexboss avatar Jan 05 '17 13:01 alexboss