Comparing version 0.4.0 to 0.4.1
(function(GeoJSON) { | ||
GeoJSON.version = '0.4.0'; | ||
GeoJSON.version = '0.4.1'; | ||
@@ -4,0 +4,0 @@ // Allow user to specify default parameters |
@@ -1,3 +0,3 @@ | ||
// geojson.js - v0.4.0 | ||
// geojson.js - v0.4.1 | ||
// (c) 2016 Casey Thomas, MIT License | ||
!function(a){function b(a,b){var c=a||{};for(var d in b)b.hasOwnProperty(d)&&!c[d]&&(c[d]=b[d]);return c}function c(a,b){if(b.crs&&d(b.crs)&&(a.crs=b.crs),b.bbox&&(a.bbox=b.bbox),b.extraGlobal){a.properties={};for(var c in b.extraGlobal)a.properties[c]=b.extraGlobal[c]}}function d(a){if("name"===a.type){if(a.properties&&a.properties.name)return!0;throw new Error('Invalid CRS. Properties must contain "name" key')}if("link"===a.type){if(a.properties&&a.properties.href&&a.properties.type)return!0;throw new Error('Invalid CRS. Properties must contain "href" and "type" key')}throw new Error('Invald CRS. Type attribute must be "name" or "link"')}function e(a){a.geom={};for(var b in a)a.hasOwnProperty(b)&&-1!==k.indexOf(b)&&(a.geom[b]=a[b],delete a[b]);f(a.geom)}function f(a){for(var b in a)a.hasOwnProperty(b)&&("string"==typeof a[b]?l.push(a[b]):"object"==typeof a[b]&&(l.push(a[b][0]),l.push(a[b][1])));if(0===l.length)throw new Error("No geometry attributes specified")}function g(a,b,c){var d={type:"Feature"};return d.geometry=h(a,b),d.properties=c.call(a),d}function h(a,b){var c={};for(var d in b.geom){var e=b.geom[d];"string"==typeof e&&a.hasOwnProperty(e)?"GeoJSON"===d?c=a[e]:(c.type=d,c.coordinates=a[e]):Array.isArray(e)&&a.hasOwnProperty(e[0])&&a.hasOwnProperty(e[1])&&(c.type=d,c.coordinates=[Number(a[e[1]]),Number(a[e[0]])])}return c}function i(a){var b;return a.exclude||a.include?a.include?b=function(b){a.include.forEach(function(a){b[a]=this[a]},this)}:a.exclude&&(b=function(b){for(var c in this)this.hasOwnProperty(c)&&-1===l.indexOf(c)&&-1===a.exclude.indexOf(c)&&(b[c]=this[c])}):b=function(a){for(var b in this)this.hasOwnProperty(b)&&-1===l.indexOf(b)&&(a[b]=this[b])},function(){var c={};return b.call(this,c),a.extra&&j(c,a.extra),c}}function j(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}a.version="0.4.0",a.defaults={},a.parse=function(a,d,f){var h,j,k=b(d,this.defaults);return l.length=0,e(k),j=i(k),Array.isArray(a)?(h={type:"FeatureCollection",features:[]},a.forEach(function(a){h.features.push(g(a,k,j))}),c(h,k)):h=g(a,k,j),f&&"function"==typeof f?void f(h):h};var k=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeoJSON"],l=[]}("object"==typeof module?module.exports:window.GeoJSON={}); | ||
!function(a){function b(a,b){var c=a||{};for(var d in b)b.hasOwnProperty(d)&&!c[d]&&(c[d]=b[d]);return c}function c(a,b){if(b.crs&&d(b.crs)&&(a.crs=b.crs),b.bbox&&(a.bbox=b.bbox),b.extraGlobal){a.properties={};for(var c in b.extraGlobal)a.properties[c]=b.extraGlobal[c]}}function d(a){if("name"===a.type){if(a.properties&&a.properties.name)return!0;throw new Error('Invalid CRS. Properties must contain "name" key')}if("link"===a.type){if(a.properties&&a.properties.href&&a.properties.type)return!0;throw new Error('Invalid CRS. Properties must contain "href" and "type" key')}throw new Error('Invald CRS. Type attribute must be "name" or "link"')}function e(a){a.geom={};for(var b in a)a.hasOwnProperty(b)&&-1!==k.indexOf(b)&&(a.geom[b]=a[b],delete a[b]);f(a.geom)}function f(a){for(var b in a)a.hasOwnProperty(b)&&("string"==typeof a[b]?l.push(a[b]):"object"==typeof a[b]&&(l.push(a[b][0]),l.push(a[b][1])));if(0===l.length)throw new Error("No geometry attributes specified")}function g(a,b,c){var d={type:"Feature"};return d.geometry=h(a,b),d.properties=c.call(a),d}function h(a,b){var c={};for(var d in b.geom){var e=b.geom[d];"string"==typeof e&&a.hasOwnProperty(e)?"GeoJSON"===d?c=a[e]:(c.type=d,c.coordinates=a[e]):Array.isArray(e)&&a.hasOwnProperty(e[0])&&a.hasOwnProperty(e[1])&&(c.type=d,c.coordinates=[Number(a[e[1]]),Number(a[e[0]])])}return c}function i(a){var b;return a.exclude||a.include?a.include?b=function(b){a.include.forEach(function(a){b[a]=this[a]},this)}:a.exclude&&(b=function(b){for(var c in this)this.hasOwnProperty(c)&&-1===l.indexOf(c)&&-1===a.exclude.indexOf(c)&&(b[c]=this[c])}):b=function(a){for(var b in this)this.hasOwnProperty(b)&&-1===l.indexOf(b)&&(a[b]=this[b])},function(){var c={};return b.call(this,c),a.extra&&j(c,a.extra),c}}function j(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}a.version="0.4.1",a.defaults={},a.parse=function(a,d,f){var h,j,k=b(d,this.defaults);return l.length=0,e(k),j=i(k),Array.isArray(a)?(h={type:"FeatureCollection",features:[]},a.forEach(function(a){h.features.push(g(a,k,j))}),c(h,k)):h=g(a,k,j),f&&"function"==typeof f?void f(h):h};var k=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeoJSON"],l=[]}("object"==typeof module?module.exports:window.GeoJSON={}); |
{ | ||
"name": "geojson", | ||
"description": "Turn your geo data into GeoJSON", | ||
"author": "Casey Thomas <caseypthomas@gmail.com>", | ||
"author": "Casey Cesari", | ||
"license": "MIT", | ||
"keywords": "geojson", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"main": "./geojson", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/caseypt/geojson.js.git" | ||
"url": "http://github.com/caseycesari/geojson.js.git" | ||
}, | ||
@@ -25,3 +25,3 @@ "dependencies": {}, | ||
"engines": { | ||
"node": "0.10.x" | ||
"node": ">= 0.10" | ||
}, | ||
@@ -28,0 +28,0 @@ "scripts": { |
@@ -1,5 +0,5 @@ | ||
[![Build Status](https://travis-ci.org/caseypt/GeoJSON.js.svg?branch=master)](https://travis-ci.org/caseypt/GeoJSON.js) | ||
[![Build Status](https://travis-ci.org/caseycesari/GeoJSON.js.svg?branch=master)](https://travis-ci.org/caseypt/GeoJSON.js) | ||
# GeoJSON.js | ||
Convert an array of objects with geometry to a [GeoJSON](http://geojson.org/) feature collection. | ||
Turn your geo data into [GeoJSON](http://geojson.org/). | ||
@@ -268,7 +268,7 @@ ## Installation | ||
To parse already encoded GeoJSON use | ||
`GeoJSON` | ||
var data = [{name: 'Location A', geo: {"type": "Point", "coordinates": [125.6, 10.1]}}]; | ||
GeoJSON.parse(data, {GeoJSON: 'geo'}); | ||
@@ -275,0 +275,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37160