Raruto / leaflet-kmz

A KMZ file loader for Leaflet Maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

missing folder infos

jayantpaliwal opened this issue · comments

While converting xml to geoJson using @tmcw/togeojson@4.1.0/dist/togeojson.umd.js is missing the folder infos.

_parseKML: function(data, props) {
		var xml = _.toXML(data, props);
		var geojson = _.toGeoJSON(xml, props);
		var layer = (this.options.geometryToLayer || this._geometryToLayer).call(this, geojson, xml);
		this.addLayer(layer);
		this.fire('load', { layer: layer, name: geojson.properties.name });
	},

it merged all the folder layers
image

I need to present the layers like google earth.

Folders-> Sub layers of folders

image

Hi @jayantpaliwal,

Javascript dependencies are lazy loaded only when not found on the page,

ie. a previous <script src="@tmcw/togeojson@4.1.0/dist/togeojson.umd.js"></script>:

leaflet-kmz/src/KMZLayer.js

Lines 140 to 152 in ed43fe9

_requiredJSModules: function() {
var urls = [];
var host = 'https://unpkg.com/';
if (typeof window.JSZip !== 'function') {
urls.push(host + 'jszip@3.5.0/dist/jszip.min.js');
}
if (typeof window.toGeoJSON !== 'object') {
urls.push(host + '@tmcw/togeojson@4.1.0/dist/togeojson.umd.js');
}
return urls;
},

The version provided by this plugin is not mandatory, otherwise please propose your own PR.

👋 Raruto