gabzim / circle-to-polygon

Receives a Coordinate, a Radius and a Number of edges and aproximates a circle by creating a polygon that fills its area
ISC License
113 stars 29 forks source link

Hotfix 10 coordinates with 3 elements cause error #11

Closed johachi closed 4 years ago

johachi commented 4 years ago

As mentioned in PR #10, according to RFC 7946

A position is an array of numbers.  There MUST be two or more elements.

and

Implementations SHOULD NOT extend positions beyond three elements.

In response to above This PR does the following:

The PR DOES NOT

This closes #10

@gabzim , @drtyh2o Since the specification does technically allow it, would it be a better solution to change validation test of the center coordinate to accept any array as long as the two first elements are valid lng and lat coordinates?

mdurling commented 4 years ago

I think accepting any array of at least 2 numbers would be reasonable since lng, lat are the only arguments required by this function.

johachi commented 4 years ago

Looks good to me.

Thanks! I will wait for @gabzim and hope he will accept the PR soon.

gabzim commented 4 years ago

👍 thanks @johachi , was not aware that you could have a third element either @drtyh2o, merging