{"_id":"@mapbox/leaflet-omnivore","_rev":"294-f49cfe5fb6400b9a8df8420fef89765d","name":"@mapbox/leaflet-omnivore","description":"a geospatial format parser for Leaflet","dist-tags":{"latest":"0.3.4"},"versions":{"0.3.4":{"name":"@mapbox/leaflet-omnivore","version":"0.3.4","description":"a geospatial format parser for Leaflet","main":"index.js","scripts":{"test":"zuul --local -- test/test.js","test-remote":"zuul -- test/test.js","test-headless":"zuul --phantom -- test/test.js","prepublish":"browserify -s omnivore index.js > leaflet-omnivore.js && uglifyjs leaflet-omnivore.js -c -m > leaflet-omnivore.min.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/leaflet-omnivore.git"},"files":["index.js","leaflet-omnivore.js","leaflet-omnivore.min.js"],"browserify":{"transform":["brfs"]},"keywords":["leaflet","formats","kml","csv","gpx","geojson","kml","leaflet","maps","gpx","wkt","osm","polyline","topojson","format","converter"],"author":{"name":"Tom MacWright"},"license":"BSD-3-Clause","bugs":{"url":"https://github.com/mapbox/leaflet-omnivore/issues"},"homepage":"https://github.com/mapbox/leaflet-omnivore","dependencies":{"csv2geojson":"~5.0.0","togeojson":"0.13.0","corslite":"0.0.7","wellknown":"0.4.2","brfs":"1.4.3","topojson":"1.6.26","polyline":"0.2.0"},"devDependencies":{"browserify":"13.0.1","tape":"4.5.1","uglify-js":"^2.6.2","jshint":"2.9.2","mocha":"~2.5.3","zuul":"~3.10.1","st":"1.1.0","mapbox.js":"2.4.0","phantomjs-prebuilt":"2.1.7"},"gitHead":"6411d1757e5ab5dc373f1dccbe8d0a1781e6f360","_id":"@mapbox/leaflet-omnivore@0.3.4","_shasum":"d8255eb981549cac421ccf9c1a56a78f6a350346","_from":".","_npmVersion":"4.0.2","_nodeVersion":"4.6.2","_npmUser":{"name":"tmcw","email":"tom@macwright.org"},"dist":{"shasum":"d8255eb981549cac421ccf9c1a56a78f6a350346","tarball":"https://registry.npmjs.org/@mapbox/leaflet-omnivore/-/leaflet-omnivore-0.3.4.tgz","integrity":"sha512-KHdJXk7EBBygCuErNkI981y51Fd80odYlBmWzsHPtmdzqmvV0D+allIi8uMiTzfW1K3aasOnOw4p6OV0rOs4TQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIARdWKA+CaL5BJhedtBgpdrVAXs75hMG7Ze7dIflK3+XAiEAlavKnYdPM2l7+MC/Kg4NGGnHuh2tSeiZpYIdaKceIeg="}]},"maintainers":[{"name":"tmcw","email":"tom@macwright.org"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/leaflet-omnivore-0.3.4.tgz_1480704638958_0.44413893087767065"},"directories":{}}},"readme":"# leaflet-omnivore\n\n![](https://farm8.staticflickr.com/7373/12376158164_e335b4e61d_b.jpg)\n\n[Leaflet](http://leafletjs.com/) supports the [GeoJSON](http://geojson.org/) format\nby default. What if you have something else? That's where omnivore comes in.\n\nIt currently supports:\n\n* [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) (via [csv2geojson](https://github.com/mapbox/csv2geojson))\n* GPX (via [toGeoJSON](https://github.com/mapbox/togeojson))\n* [KML](http://developers.google.com/kml/documentation/) (via [toGeoJSON](https://github.com/mapbox/togeojson))\n* [WKT](http://en.wikipedia.org/wiki/Well-known_text) (via [wellknown](https://github.com/mapbox/wellknown))\n* [TopoJSON](https://github.com/mbostock/topojson)\n* [Encoded Polylines](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) via [polyline](https://github.com/mapbox/polyline)\n\nOmnivore also includes an AJAX library, [corslite](https://github.com/mapbox/corslite),\nso you can specify what you want to add to the map with just a URL.\n\n## Installation\n\nuse it easily with the [Mapbox Plugins CDN](http://mapbox.com/mapbox.js/plugins/#leaflet-omnivore):\n\n```html\n<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>\n```\n\n\nOr download `leaflet-omnivore.min.js` from this repository.\n\n## example\n\nLive examples:\n\n* [WKT](https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-wkt/)\n* [TopoJSON](https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-topojson/)\n* [Tooltips](https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-kml-tooltip/)\n* [KML](https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-kml/)\n* [GPX](https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-gpx/)\n* [Icons](https://www.mapbox.com/mapbox.js/example/v1.0.0/markers-from-csv-custom-style/)\n* [CSV](https://www.mapbox.com/mapbox.js/example/v1.0.0/markers-from-csv/)\n\n```js\nvar map = L.mapbox.map('map', 'mapbox.streets')\n    .setView([38, -102.0], 5);\n\nomnivore.csv('a.csv').addTo(map);\nomnivore.gpx('a.gpx').addTo(map);\nomnivore.kml('a.kml').addTo(map);\nomnivore.wkt('a.wkt').addTo(map);\nomnivore.topojson('a.topojson').addTo(map);\nomnivore.geojson('a.geojson').addTo(map);\nomnivore.polyline('a.txt').addTo(map);\n```\n\n## API\n\nArguments with `?` are optional. **parser_options** consists of options\nsent to the parser library, _not_ to the layer: if you want to provide options\nto the layer, see the example in the Custom Layers section.\n\nBy default, the library will construct a `L.geoJson()` layer internally and\ncall `.addData(geojson)` on it in order to load it full of GeoJSON. If you want\nto use a different kind of layer, like a `L.mapbox.featureLayer()`, you can,\nby passing it as `customLayer`, as long as it supports events and `addData()`.\nYou can also use this API to pass custom options to a `L.geoJson()` instance.:\n\n\n* `.csv(url, parser_options?, customLayer?)`: Load & parse CSV, and return layer. Options are the same as [csv2geojson](https://github.com/mapbox/csv2geojson#api): `latfield, lonfield, delimiter`\n* `.csv.parse(csvString, parser_options?)`: Parse CSV, and return layer.\n* `.kml(url)`: Load & parse KML, and return layer.\n* `.kml.parse(kmlString | gpxDom)`: Parse KML from a string of XML or XML DOM, and return layer.\n* `.gpx(url, parser_options?, customLayer?)`: Load & parse GPX, and return layer.\n* `.gpx.parse(gpxString | gpxDom)`: Parse GPX from a string of XML or XML DOM, and return layer.\n* `.geojson(url, parser_options?, customLayer?)`: Load GeoJSON file at URL, parse GeoJSON, and return layer.\n* `.wkt(url, parser_options?, customLayer?)`: Load & parse WKT, and return layer.\n* `.wkt.parse(wktString)`: Parse WKT, and return layer.\n* `.topojson(url, parser_options?, customLayer?)`: Load & parse TopoJSON, and return layer.\n* `.topojson.parse(topojson)`: Parse TopoJSON (given as a string or object), and return layer.\n* `.polyline(url, parser_options?, customLayer?)`: Load & parse polyline, and return layer.\n* `.polyline.parse(txt, options, layer)`: Parse polyline (given as a string or object), and return layer.\n\nValid options:\n\n#### polyline\n\n* `precision` will change how the polyline is interpreted. By default, the value\n  is 5. This is the [factor in the algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm),\n  by default 1e5, which is adjustable.\n\n### Custom Layers\n\nPassing custom options:\n\n```js\nvar customLayer = L.geoJson(null, {\n    filter: function() {\n        // my custom filter function\n        return true;\n    }\n});\n\nvar myLayer = omnivore.csv('foo', null, customLayer);\n```\n\nAdding custom styles to a GeoJSON layer:\n\n```js\nvar customLayer = L.geoJson(null, {\n    // http://leafletjs.com/reference.html#geojson-style\n    style: function(feature) {\n        return { color: '#f00' };\n    }\n});\n// this can be any kind of omnivore layer\nvar runLayer = omnivore.kml('line.kml', null, customLayer)\n```\n\nUsing a `L.mapbox.featureLayer`:\n\n```js\nvar layer = omnivore.gpx('a.gpx', null, L.mapbox.featureLayer());\n```\n\n### Async & Events\n\nEach function returns an `L.geoJson` object. Functions that load from URLs\nare **asynchronous**, so they will **not** immediately expose accurate `.setGeoJSON()` functions.\n\nFor this reason, we fire events:\n\n* `ready`: fired when all data is loaded into the layer\n* `error`: fired if data can't be loaded or parsed\n\n```js\nvar layer = omnivore.gpx('a.gpx')\n    .on('ready', function() {\n        // when this is fired, the layer\n        // is done being initialized\n    })\n    .on('error', function() {\n        // fired if the layer can't be loaded over AJAX\n        // or can't be parsed\n    })\n    .addTo(map);\n```\n\n`ready` does **not** fire if you don't use an asynchronous form of the function\nlike `.topojson.parse()`: because you don't need an event. Just run your code\nafter the call.\n\n## Development\n\nThis is a [browserify](http://browserify.org/) project:\n\n```sh\ngit clone git@github.com:mapbox/leaflet-omnivore.git\n\ncd leaflet-omnivore\n\n# to run tests\nnpm install\n\n# to build leaflet-omnivore.js\nnpm run build\n```\n\n`leaflet-omnivore.js` and `leaflet-omnivore.min.js` are **built files** generated\nfrom `index.js` by `browserify`. If you find an issue, it either needs to be\nfixed in `index.js`, or in one of the libraries leaflet-omnivore uses\nto parse formats.\n\n## FAQ\n\n* **What if I just want one format?** Lucky for you, each format is specified\n  in a different module, so you can just use [TopoJSON](https://github.com/mbostock/topojson),\n  [csv2geojson](https://github.com/mapbox/csv2geojson), [wellknown](https://github.com/mapbox/wellknown), or\n  [toGeoJSON](https://github.com/mapbox/togeojson)\n  individually.\n* **My AJAX request is failing for a cross-domain request**. Read up on the [Same Origin Restriction](http://en.wikipedia.org/wiki/Same-origin_policy).\n  By default, we use corslite, so cross-domain requests will try to use [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing)\n  if your server and browser supports it, but if one of them doesn't, there's no\n  way on the internet to support your request.\n* **Why isn't JSONP supported?** [Here's why](https://gist.github.com/tmcw/6244497).\n","maintainers":[{"email":"yannick.meeus+npm+production+ci@mapbox.com","name":"mbx-npm-ci-production"},{"email":"yannick.meeus+npm+staging+ci@mapbox.com","name":"mbx-npm-ci-staging"},{"email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-production"},{"email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-staging"},{"email":"yannick.meeus+npm+prod+09@mapbox.com","name":"mbx-npm-09-production"},{"email":"yannick.meeus+npm+prod+08@mapbox.com","name":"mbx-npm-08-production"},{"email":"yannick.meeus+npm+prod+07@mapbox.com","name":"mbx-npm-07-production"},{"email":"yannick.meeus+npm+prod+06@mapbox.com","name":"mbx-npm-06-production"},{"email":"yannick.meeus+npm+prod+05@mapbox.com","name":"mbx-npm-05-production"},{"email":"yannick.meeus+npm+prod+04@mapbox.com","name":"mbx-npm-04-production"},{"email":"yannick.meeus+npm+prod+03@mapbox.com","name":"mbx-npm-03-production"},{"email":"yannick.meeus+npm+prod+02@mapbox.com","name":"mbx-npm-02-production"},{"email":"yannick.meeus+npm+prod+01@mapbox.com","name":"mbx-npm-01-production"},{"email":"yannick.meeus@mapbox.com","name":"mbx-npm-02-staging"},{"email":"accounts+npmjs-01@mapbox.com","name":"mapbox-npm-01"},{"email":"accounts+npmjs-02@mapbox.com","name":"mapbox-npm-02"},{"email":"accounts+npmjs-07@mapbox.com","name":"mapbox-npm-07"},{"email":"accounts+npmjs-03@mapbox.com","name":"mapbox-npm-03"},{"email":"accounts+npmjs-04@mapbox.com","name":"mapbox-npm-04"},{"email":"accounts+npmjs-09@mapbox.com","name":"mapbox-npm-09"},{"email":"accounts+npmjs-05@mapbox.com","name":"mapbox-npm-05"},{"email":"accounts+npmjs-06@mapbox.com","name":"mapbox-npm-06"},{"email":"accounts+npmjs-08@mapbox.com","name":"mapbox-npm-08"},{"email":"accounts+npmjs-advanced-actions@mapbox.com","name":"mapbox-npm-advanced-actions"},{"email":"accounts+npmjs-npm-ci@mapbox.com","name":"mapbox-npm-ci"},{"email":"accounts+npmjs@mapbox.com","name":"mapbox-npm"},{"email":"accounts@mapbox.com","name":"mapbox-admin"},{"email":"accounts+npm-mapbox-machine-user@mapbox.com","name":"mapbox-machine-user"}],"time":{"modified":"2023-01-12T12:43:07.393Z","created":"2016-12-02T18:50:41.186Z","0.3.4":"2016-12-02T18:50:41.186Z"},"homepage":"https://github.com/mapbox/leaflet-omnivore","keywords":["leaflet","formats","kml","csv","gpx","geojson","kml","leaflet","maps","gpx","wkt","osm","polyline","topojson","format","converter"],"repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/leaflet-omnivore.git"},"author":{"name":"Tom MacWright"},"bugs":{"url":"https://github.com/mapbox/leaflet-omnivore/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md"}