Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArcByCenterPoint #649

Closed
Adraesh opened this issue Apr 7, 2017 · 9 comments
Closed

ArcByCenterPoint #649

Adraesh opened this issue Apr 7, 2017 · 9 comments
Milestone

Comments

@Adraesh
Copy link

Adraesh commented Apr 7, 2017

Hi!

I did not find any method provided by the Turf lib which handle my case.

In fact, I have:

  • startAngle (degrees)
  • endAngle (degrees)
  • radius (kilometers)
  • centerPoint (long, lat) Center of the whole circle.

Basically I want to generate and ArcByCenterPoint with those data.

Is it possible ?

Thanks.

@Adraesh
Copy link
Author

Adraesh commented Apr 9, 2017

Hi!

I just tested the turf-sector method and obviously there is a misunderstanding. Well the method itself is working perfectly but this is not what I requested.

screen shot 2017-04-09 at 6 07 22 pm

In fact I got a circle sector but what I want is ONLY the line Arc not the entire sector :)

Thanks!

@DenisCarriere
Copy link
Member

I don't think there's any misunderstanding, what @stebogit implemented lines up perfectly with #155.

This new module request would be called @turf/line-arc which would have this as a result (red line):

image

@Adraesh Feel free to send a PR to TurfJS if you want specific modules implemented.

@Adraesh
Copy link
Author

Adraesh commented Apr 9, 2017

Thanks Denis, but what I wanted to say is that my post can't be referenced to the turf-sector module newly implemented :)

@stebogit
Copy link
Collaborator

stebogit commented Apr 9, 2017

@DenisCarriere @Adraesh I can easily implement a turf-arc-line module simply extracting a currently private function inside the sector module.

@Adraesh
Copy link
Author

Adraesh commented Apr 9, 2017

Hey stebogit!

I believe you are talking about this method:

function getArcLine(center, radius, angle1, angle2, steps, units)

It would be really appreciated if you can do that.

Thank you very much.

@DenisCarriere
Copy link
Member

👍 @stebogit Sounds like a plan, afterwards you can add @turf/line-arc as a dependency to @turf/sector.

@DenisCarriere
Copy link
Member

Thanks to @stebogit @turf/line-arc is now available on npm.

@DenisCarriere DenisCarriere added this to the 4.1.0 milestone Apr 10, 2017
@stebogit
Copy link
Collaborator

stebogit commented Apr 10, 2017

Tanks also to @DenisCarriere! 👍
I'll add @turf/line-arc as a dependency to @turf/sector then.

@aziz-boudi4
Copy link

aziz-boudi4 commented Jan 8, 2018

I'm using a <Layer> and a <Feature> from react-mapbox-gl to draw a line from Point A to Point B ( see screenshot 1)

My goal is to use line-arc and center from turf js in order to have a curved line between point A and point B

I managed to get a curved line, but it's not starting at Point A and it's not finishing at Point B... it is instead drawn in the middle of the map (see screenshot number 2)

Here is my code

     const features = turf.featureCollection([
       turf.point(this.state.startFlying),   // [-122.3811441, 37.6213129]
       turf.point(this.state.destinationFlying),  // [-118.4107187, 33.9415889]
     ]);

    const theCenter = turf.center(features);
    const arcRadius = 5;
    const bearing1 = 25;
    const bearing2 = 47;

    const arc = turf.lineArc(theCenter, arcRadius, bearing1, bearing2);
    const mappedCurvedFlyingCurve = arc.geometry.coordinates;

screen shot 2018-01-08 at 1 17 16 pm

screen shot 2018-01-08 at 1 22 10 pm

screen shot 2018-01-08 at 1 22 31 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants