0

i am trying to get a point on circle's 30 degree angle but don't know the specific thing that i have to try. Until now i tried two example 1) get angle by applying formula : x = Xc + R * cos(angle) y = Yc + R * sin(angle)

Code :

const radius1 = circle.getRadius();
    const cx = 29.505;
    const cy = 70.09;
    const radiusInKm = 500;
    const angleInDegrees = 90;
    // x = Xc + R * cos(theta)
    // y = Yc + R * sin(theta)
    const Xc = cx + radius1 * Math.cos(90);
    const Yc = cy + radius1 * Math.sin(90);
    let marker = L.marker([Xc, Yc]).addTo(this.map);

2) use leaflet geometry Utils Code:

 let A = L.marker([29.505, 70.09]).addTo(this.map);
    let B = geometry.destination(A.getLatLng(), angleInDegrees, radiusInKm * 1000);
    console.log(B.getLatLng());
    L.marker(B).addTo(this.map);

before code imports are *import * as L from 'leaflet'; import {geometry} from 'leaflet-geometryutil';*

The problem with 1 is that it gave results as Xc = 42574.68122670592 Yc = -15240.531055110834 and the problem with 2 is showing in debugging mode of browser that is "leaflet_geometryutil__WEBPACK_IMPORTED_MODULE_2__.geometry is undefined"

FatimaAsif
  • 13
  • 3

0 Answers0