Hi all,
I have a set of lines that denote a direction of movement. I would like to create 45 degree sectors that are centred on each line (i.e.) 22.5 degrees on either side of the existing line. I've tried the distance and direction tool but not sure if it's the correct tool for the job or if I'm not using it correctly - any suggestions?
Thanks! I'll give this a try
Basic code
import numpy as np def _arc_sector(radius=100, start=0, stop=1, step=0.1, xc=0.0, yc=0.0): """Create an arc from a specified radius, centre and start/stop angles Requires: --------- `radius` : number cirle radius from which the arc is obtained `start`, `stop`, `step` : numbers angles in degrees `xc`, `yc` : number center coordinates in projected units Returns: -------- points on the arc """ start, stop = sorted([start, stop]) angle = np.deg2rad(np.arange(start, stop, step)) x_s = radius*np.cos(angle) # X values y_s = radius*np.sin(angle) # Y values pnts = np.c_[x_s, y_s] cent = np.array([xc, yc]) pnts = pnts + cent sector = np.concatenate((cent[None, :], pnts, cent[None, :]), axis=0) return sector
Sample to give you an idea
radius = 10. x_c, y_c = 0., 0. line_ang = 45. # your line angle/direction... start, stop = line_ang - 22.5, line_ang + 22.5 # start and stop relative to it ar = _arc_sector(radius=10, start=start, stop=stop, step=2.0, xc=x_c, yc=y_c)
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.