{"id":24918015,"url":"https://github.com/makinacorpus/leaflet.filelayer","last_synced_at":"2025-04-13T00:43:11.491Z","repository":{"id":7531249,"uuid":"8882913","full_name":"makinacorpus/Leaflet.FileLayer","owner":"makinacorpus","description":"Loads files locally (GeoJSON, KML, GPX) as layers using HTML5 File API","archived":false,"fork":false,"pushed_at":"2024-01-15T15:27:34.000Z","size":1619,"stargazers_count":281,"open_issues_count":40,"forks_count":90,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-13T00:43:07.175Z","etag":null,"topics":["javascript","leaflet"],"latest_commit_sha":null,"homepage":"http://makinacorpus.github.io/Leaflet.FileLayer/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makinacorpus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-19T16:11:34.000Z","updated_at":"2025-03-07T03:35:09.000Z","dependencies_parsed_at":"2024-01-15T17:09:12.179Z","dependency_job_id":"cb07040b-0df5-40ce-89ee-20055910c024","html_url":"https://github.com/makinacorpus/Leaflet.FileLayer","commit_stats":{"total_commits":107,"total_committers":17,"mean_commits":6.294117647058823,"dds":0.6635514018691588,"last_synced_commit":"4f1614faa1c24fe737498fc5f51163e78c4f2d18"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2FLeaflet.FileLayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2FLeaflet.FileLayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2FLeaflet.FileLayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makinacorpus%2FLeaflet.FileLayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makinacorpus","download_url":"https://codeload.github.com/makinacorpus/Leaflet.FileLayer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650418,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","leaflet"],"created_at":"2025-02-02T09:17:20.821Z","updated_at":"2025-04-13T00:43:11.469Z","avatar_url":"https://github.com/makinacorpus.png","language":"JavaScript","readme":"Leaflet.FileLayer\n=================\n\n\n\nLoads local files (GeoJSON, JSON, GPX, KML) into the map using the [HTML5 FileReader API](http://caniuse.com/filereader), **without server call** !\n\n* A simple map control\n* The user can browse a file locally\n* It is read locally (``FileReader``) and converted to GeoJSON\n* And loaded as a layer eventually!\n\n\u003cp  align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/leaflet-filelayer\"\u003e\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/leaflet-filelayer\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/leaflet-filelayer\"\u003e\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/v/leaflet-filelayer?color=red\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv class=\"demo\"\u003e\n\u003cp align=\"center\"\u003e Check out the \u003ca href=\"https://makinacorpus.github.io/Leaflet.FileLayer/\"\u003edemo\u003c/a\u003e ! \u003c/p\u003e\n\u003c/div\u003e\n\n\nFor GPX and KML files, it currently depends on [Tom MacWright's togeojson.js](https://github.com/tmcw/togeojson).\n\n\n\nInstall\n-----\nIn order to use this plugin in your app you can either:\n* install it via your favorite package manager:\n    * `npm i leaflet-filelayer`\n    * `bower install git://github.com:makinacorpus/Leaflet.FileLayer.git`\n* download the repository and import the `leaflet.filelayer.js` file in your app.\n\nDependencies and compatibilities\n-----\nIn order to use this plugin, you need to have both `leaflet` and `togeojson` installed.\nIf you're using Leaflet \u003c 1, you need to use the version `0.6.0` of this plugin. After that, Leaflet \u003e 1 is required.\n\nUsage\n-----\n\n```javascript\n    var map = L.map('map').fitWorld();\n    ...\n    L.Control.fileLayerLoad({\n        // Allows you to use a customized version of L.geoJson.\n        // For example if you are using the Proj4Leaflet leaflet plugin,\n        // you can pass L.Proj.geoJson and load the files into the\n        // L.Proj.GeoJson instead of the L.geoJson.\n        layer: L.geoJson,\n        // See http://leafletjs.com/reference.html#geojson-options\n        layerOptions: {style: {color:'red'}},\n        // Add to map after loading (default: true) ?\n        addToMap: true,\n        // File size limit in kb (default: 1024) ?\n        fileSizeLimit: 1024,\n        // Restrict accepted file formats (default: .geojson, .json, .kml, and .gpx) ?\n        formats: [\n            '.geojson',\n            '.kml'\n        ]\n    }).addTo(map);\n```\n\nEvents:\n\n* **data:loaded** (event)\n\n```javascript\n    var control = L.Control.fileLayerLoad();\n    control.loader.on('data:loaded', function (event) {\n        // event.layer gives you access to the layers you just uploaded!\n\n        // Add to map layer switcher\n        layerswitcher.addOverlay(event.layer, event.filename);\n    });\n```\n\n* **data:error** (error)\n```javascript\n    var control = L.Control.fileLayerLoad();\n    control.loader.on('data:error', function (error) {\n        // Do something usefull with the error!\n        console,error(error);\n    });\n```\n\nChangelog\n---------\n\n### 1.2.0 ###\n\n* Leaflet 1.2.0 compatibility\n* Accept `json` file as input (thanks kkdd)\n\n### 1.1.0 ###\n\n* Leaflet 1.1.0 compatibility (thanks @thorinii)\n\n### 0.6.0 ###\n\n* Better plugin packaging and dependencies\n* Adding bower support (thanks @george-silva)\n* Adding support for custom geoJson layers (thanks @MuellerMatthew)\n* Treating json files as geoJson (thanks @Jmuccigr)\n\n### 0.5.0 ###\n\n* Load multiple files (thanks @jens-duttke)\n\n### 0.4.0 ###\n\n* Support whitelist for file formats (thanks CJ Cenizal)\n\n### 0.3.0 ###\n\n* Add `data:error` event (thanks @joeybaker)\n* Fix multiple uploads (thanks @joeybaker)\n* Add `addToMap` option (thanks @joeybaker)\n\n(* Did not release version 0.2 to prevent conflicts with Joey's fork. *)\n\n### 0.1.0 ###\n\n* Initial working version\n\nAuthors\n-------\n\n[![Makina Corpus](http://depot.makina-corpus.org/public/logo.gif)](http://makinacorpus.com)\n\nContributions\n\n* Mathieu Leplatre\n* Joey Baker http://byjoeybaker.com\n* CJ Cenizal\n* Jens-duttke\n* Jmuccigr\n* Matthew Mueller\n* George Silva\n* Simon Bats\n* Opoto\n* Lachlan Phillips\n* kkdd","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakinacorpus%2Fleaflet.filelayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakinacorpus%2Fleaflet.filelayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakinacorpus%2Fleaflet.filelayer/lists"}