Closed allmondjoy87 closed 2 years ago
import { applyConverter } from '@terraformer/spatial'
// Runs the passed function against every Coordinate in the geojson object.
// Your function will be passed a Coordinate and will be expected to return a Coordinate.
applyConverter(geojson, yourFunction);
if someone is interested in adding JSDoc for the method to ensure it shows up in the documentation, that'd be welcome.
aha!! I was getting "TypeError: Object(...) is not a function"
errors and assumed it was an issue with my converter function.
After digging a little deeper applyConverter
is missing in the exports section in the t-spatial.esm.js and t-spatial.umd.js files. I added it in my source code and everything's gravy.
if someone wants to export the utility function in the file below and add JSDoc, i'd be more than happy to publish the change.
https://github.com/terraformer-js/terraformer/blob/master/packages/spatial/src/index.js
looks like this hasn't been updated yet, any chance someone can make the fix? is this something i can do? i've never contributed to a project before, unsure what the rules are.
is this something i can do? i've never contributed to a project before, unsure what the rules are.
absolutely. to do this you'd just need to:
npm install && npm test
locally to ensure all is wellexport
in packages/spatial/src/index.js
npm run doc
to update the README for the spatial package to mention the new methodnpm test
again to confirm all is still well/**
* Runs the passed function against every Coordinate in the geojson object.
* @function
* @param {object} GeoJSON - The input [GeoJSON](https://tools.ietf.org/html/rfc7946) Geometry, Feature, GeometryCollection or FeatureCollection.
* @param {function} function - Your function will be passed a Coordinate and will be expected to return a Coordinate.
* @return {object} GeoJSON - [GeoJSON](https://tools.ietf.org/html/rfc7946) with altered coordinates.
* ```js
* import { applyConverter } from "@terraformer/spatial"
*
* applyConverter({
* type: "Point",
* coordinates: [ 45, 60 ]
* }, (coord) => [coord[0] + 1, coord[1] - 1])
*
* >> { type: "Point", coordinates: [ 46, 59 ] }
* ```
*/
Well I'm having issues with npm-install
. Getting tarball and ultimately EINTEGRITY errors when it tries to install jison@git+ssh.
lerna ERR! npm install exited 1 in '@terraformer/wkt'
lerna ERR! npm install stderr:
npm WARN deprecated nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN tarball tarball data for jison@git+ssh://git@github.com/GabrielRatener/jison.git#2668d7efbb628c763dc7cce41ab24a4632528942 (sha512-NHThbqidF4gPr4YwTd6MUFqGiUdWbYqcBAFH1gPYWaLmoHWafH/kCGjDmJkFKEV2XkeWAyODEBT95mzZVa67sA==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for jison@git+ssh://git@github.com/GabrielRatener/jison.git#2668d7efbb628c763dc7cce41ab24a4632528942 (sha512-NHThbqidF4gPr4YwTd6MUFqGiUdWbYqcBAFH1gPYWaLmoHWafH/kCGjDmJkFKEV2XkeWAyODEBT95mzZVa67sA==) seems to be corrupted. Trying again.
npm ERR! code EINTEGRITY
npm ERR! sha512-NHThbqidF4gPr4YwTd6MUFqGiUdWbYqcBAFH1gPYWaLmoHWafH/kCGjDmJkFKEV2XkeWAyODEBT95mzZVa67sA== integrity checksum failed when using sha512: wanted sha512-NHThbqidF4gPr4YwTd6MUFqGiUdWbYqcBAFH1gPYWaLmoHWafH/kCGjDmJkFKEV2XkeWAyODEBT95mzZVa67sA== but got sha512-ZBsVuTEO3DrliKB3f8FABrVAz6p2fazutqBn3inowySvzbUEfvJc9tF+fwvBX1WJm58FeU2rVRg6i3USFrNYeg==. (33143 bytes)
However I saw you very recently made a branch "patch-68" that looks like it handles the fix! Whats up with that?
if you use Node.js 16x or 17x, the install should succeed.
patch-68
can't be merged as is. it has a bunch of unrelated whitespace changes.
node --version
v16.14.0
Failing w/ 16x. npm cache verify
and npm cache clean --force
didn't help either.
I'll update to 17x and give it a shot.
Well I'm having issues with
npm install
i think what i did in #87 will fix your issue.
How do I use the applyConverter tool with the latest release?