Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix creation and settings of geoJSON object #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/leaflet.filelayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}(function fileLoaderFactory(L, toGeoJSON) {
var FileLoader = L.Layer.extend({
options: {
layer: L.geoJson,
layer: L.geoJSON,
layerOptions: {},
fileSizeLimit: 1024
},
Expand Down Expand Up @@ -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.');
Expand Down