geojson-project
Advanced tools
Comparing version 1.0.1 to 2.0.0
{ | ||
"name": "geojson-project", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Util for processing geojson coordinates, in most cases to project them", | ||
"main": "index.js", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"browser": "dist/index.umd.js", | ||
"jsdelivr": "dist/index.umd.js", | ||
"unpkg": "dist/index.umd.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"test": "tape test.js" | ||
"test": "node --test", | ||
"build": "vite build && npm run types", | ||
"types": "tsc --emitDeclarationOnly --declaration --declarationDir dist index.ts" | ||
}, | ||
@@ -26,4 +37,9 @@ "repository": { | ||
"devDependencies": { | ||
"tape": "^4.4.0" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.4", | ||
"@types/geojson": "^7946.0.10" | ||
}, | ||
"dependencies": { | ||
"@types/geojson": "^7946.0.10" | ||
} | ||
} |
@@ -1,38 +0,45 @@ | ||
# geojson-project [![npm version](https://badge.fury.io/js/geojson-project.svg)](https://badge.fury.io/js/geojson-project) ![circle](https://circleci.com/gh/w8r/geojson-project.svg?style=shield&circle-token=597a6db31df1e249a8a9bf29531f7baefc142641) | ||
# geojson-project [![npm version](https://badge.fury.io/js/geojson-project.svg)](https://badge.fury.io/js/geojson-project) | ||
## API | ||
*`geojsonProject(geojson, func, context)`* | ||
* `geojson` is `Feature` or `FeatureCollection` | ||
* `func` is the project function, takes in one coordinate pair, | ||
returns it transformed | ||
* `context` _optional_ - transform function's `this` | ||
_`geojsonProject(geojson, func, context)`_ | ||
- `geojson` is `Feature` or `FeatureCollection` | ||
- `func` is the project function, takes in one coordinate pair, | ||
returns it transformed | ||
- `context` _optional_ - transform function's `this` | ||
returns transformed copy of GeoJSON | ||
## Usage | ||
```js | ||
var geojsonProject = require('geojson-project'); | ||
var geojsonProject = require("geojson-project"); | ||
geojsonProject({ | ||
type: 'FeatureCollection', | ||
features: [{ | ||
type: 'Feature', | ||
properties: {a : 1}, | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [6, 6] | ||
} | ||
}, { | ||
type: 'Feature', | ||
properties: {a : 2}, | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [4, 4] | ||
} | ||
}] | ||
}, function(coord) { | ||
return [coords[0]/2, coords[1]/2]; | ||
}); | ||
geojsonProject( | ||
{ | ||
type: "FeatureCollection", | ||
features: [ | ||
{ | ||
type: "Feature", | ||
properties: { a: 1 }, | ||
geometry: { | ||
type: "Point", | ||
coordinates: [6, 6], | ||
}, | ||
}, | ||
{ | ||
type: "Feature", | ||
properties: { a: 2 }, | ||
geometry: { | ||
type: "Point", | ||
coordinates: [4, 4], | ||
}, | ||
}, | ||
], | ||
}, | ||
function (coord) { | ||
return [coords[0] / 2, coords[1] / 2]; | ||
} | ||
); | ||
``` | ||
@@ -69,3 +76,2 @@ | ||
## License | ||
@@ -75,3 +81,3 @@ | ||
Copyright (c) 2016 Alexander Milevski | ||
Copyright (c) 2023 Alexander Milevski | ||
@@ -78,0 +84,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
99
Yes
9156
1
3
123
1
+ Added@types/geojson@^7946.0.10
+ Added@types/geojson@7946.0.15(transitive)