0

I'm trying to use: https://www.npmjs.com/package/concavehull And I don't know how to assign an array in order to use it with ConcaveHull npm.

The documentation says "all you have to do is pass an array of objects that conform to the { x: {Number}, y: {Number} } format".

Is that something like this:

[{"x":-0.206792373176235,"y":51.4911165465815}, {"x":-0.206792373176235,"y":51.4911165465815},{"x":-0.206792373176235,"y":51.4911165465815},{"x":-0.206792373176235,"y":51.4911165465815} ... ]

karakulj
  • 123
  • 4
  • 11
  • 1
    That wouldn't be an array; it would be an object. – elixenide Jan 23 '15 at 14:29
  • Ok, so what should I use? – karakulj Jan 23 '15 at 14:31
  • 1
    it clearly says *pass an array of objects*, did you read the doc fully? and what is your exact issue here? – code-jaff Jan 23 '15 at 14:33
  • I need to get coordinates from database an to process them with this concavehull npm module (this is node.js). It should return points that form concave hull. So how should I initialize this array of coordinates to be processed with concave hull algorithm? – karakulj Jan 23 '15 at 14:40
  • It's not clear to me what exactly you are having problems with. Maybe a [tutorial about arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Predefined_Core_Objects) helps? – Felix Kling Jan 23 '15 at 14:42
  • What does this notation mean: "{ x: {Number}, y: {Number} }" ? – karakulj Jan 23 '15 at 14:45
  • That means the API expects an object with two properties, x and y, both of which should hold number values. – Felix Kling Jan 23 '15 at 15:13

1 Answers1

1

Yes, that is exactly it, based on what I read.

var j = [{x: 51.2, y: 34.3},
         {x: 52.2, y: 37.3}];

console.log(j[0].x); // 51.2
cgf
  • 3,369
  • 7
  • 45
  • 65