2

I have a mind to generate arc from given parameters:

  • start point coordinates
  • arcDistance
  • arcBearing
  • arcOrigin coordinates.

My concept is, calculate the end point of arc (function geo.sphere.destination from geo-py) and then obtain my arc as an circular approximation to a curve between two known points. My arcDistance is in Nautical miles, coordinates in decimal degrees WGS84 -> so I have to convert my distance to meters first and reproject coordinates to EPSG:3857.

It sounds quite obvious, I hope my mistake is easy to detect...

This is the apparent poly, that I have to create by its initial parameters are: segment coordinates and arc parameters.

polygon and arc

from geo import sphere
import numpy as np
from numpy import cos, sin, arccos

num = 30    # number of vertices
dist = 16.2*1.852*1000 # conversion from nautical miles to meters
bearing = 20.2
xc, yc = 129.77333, 62.09333    # center coordinates
start_point = (129.97278, 62.345554)

end_point = sphere.destination(start_point, dist, bearing)
start3857 = sphere.from4326_to3857(start_point)
end3857 = sphere.from4326_to3857(end_point)
center3857 = sphere.from4326_to3857((xc, yc))
start_t = inv_parametric_circle(start3857[0], center3857[0], dist)
end_t = inv_parametric_circle(end3857[0], center3857[0], dist)
arc_T = np.linspace(start_t, end_t, num)
X, Y = parametric_circle(arc_T, center3857[0], center3857[1], dist)
print(LineString(list(zip(X, Y))))

It throws an error

RuntimeWarning: invalid value encountered in arccos

It happens because (x-xc)/R in arccos for end point > 1.

According to the second link, the arc in generated counter-clockwise orientation. But mine is clockwise (it is defined). Is it the thing? I think it is no sence what comes first in np.linspace(start_t, end_t, num).

When I suppose the end point is (129.9022, 61.8311) (pick from the poly in QGIS) I get the violet arc. Where I am wrong?

ADD initial data

poly with the points

pt1. Latitude, Longitude = 61.8311099249838, 129.902226489833

pt2. Latitude, Longitude = 61.9083321543816, 129.540004313443

pt3. Latitude, Longitude = 62.0066654815873, 129.568337657929

pt4. Latitude, Longitude = 62.0849988070938, 129.685004324387

pt5. arcOriginLocation. Latitude, Longitude = 62.0933321372233, 129.773337650299

Latitude, Longitude = 62.3455543397702, 129.972782111281

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.