Question:
I extracted the OSM XML node for a light house with sector lights to use for some graphics.
However, the sector values do not make sense to me.
I found the attributes mentioned on several wiki pages:
but none of these seems to specify the units or interpretation of the values.
The first example on https://wiki.openstreetmap.org/wiki/Seamarks/Sectored_and_Directional_Lights clearly shows the first sector directed to the north-east, while its values are:
seamark:light:1:sector_end=260
seamark:light:1:sector_start=230
Solution:
The values are the heading in degrees, from a vessel. I was looking for the opposite angle...
Here's a Python snippet to convert the angles (you may be able to run this on an "online Python" service):
#!python3
#coding=utf-8
""" Invert OSM seamark sector headings (degrees as seen from light)"""
import sys,re
toggle = False
with open("OSM_node.xml") as f:
for line in f:
if "sector" in line:
# get heading angle
mo = re.search("'(\d+.\d)'", line)
heading = float( mo.groups()[0] )
# "invert" angle
angle = heading - 180
if angle < 0:
angle = angle + 360
# optional: flip angles > 180 degrees (for SolveSpace CAD)
if angle > 180:
angle = (angle - 360)
# print value and add a blank line every other
print( angle )
if toggle:
print()
toggle = not toggle
# EOF
PS / OT:
You are welcome to start submitting your question anonymously.
After submiting your question, you will be redirected to the login/signup page. Your question will > be saved in the current session and will be published after you login with your existing account,
or signup for a new account and validate your email.
is misleading (cannot submit anonymously) and did not work for me / question lost after registration.
asked
10 Sep '18, 09:59
whyohwhyohwhy
11●1●1●3
accept rate:
0%