diff --git a/README.md b/README.md index 1cd285d..91703d9 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,12 @@ Usage var map = L.map('map').fitWorld(); ... L.Control.fileLayerLoad({ - // Allows you to use a customized version of L.geoJson. + // Allows you to use a customized version of L.GeoJSON. // For example if you are using the Proj4Leaflet leaflet plugin, - // you can pass L.Proj.geoJson and load the files into the - // L.Proj.GeoJson instead of the L.geoJson. - layer: L.geoJson, - // See http://leafletjs.com/reference.html#geojson-options + // you can pass L.Proj.GeoJSON and load the files into the + // L.Proj.GeoJSON instead of the L.geoJSON. + layer: L.geoJSON, + // See https://leafletjs.com/reference.html#geojson layerOptions: {style: {color:'red'}}, // Add to map after loading (default: true) ? addToMap: true, diff --git a/src/leaflet.filelayer.js b/src/leaflet.filelayer.js index c164ffa..c31dbbc 100644 --- a/src/leaflet.filelayer.js +++ b/src/leaflet.filelayer.js @@ -41,7 +41,7 @@ }(function fileLoaderFactory(L, toGeoJSON) { var FileLoader = L.Layer.extend({ options: { - layer: L.geoJson, + layer: L.geoJSON, layerOptions: {}, fileSizeLimit: 1024 }, @@ -198,7 +198,7 @@ if (typeof content === 'string') { content = JSON.parse(content); } - layer = this.options.layer(content, this.options.layerOptions); + layer = this.options.layer.addData(content, this.options.layerOptions); if (layer.getLayers().length === 0) { throw new Error('GeoJSON has no valid layers.');