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.

This question is marked "community wiki".

asked 10 Sep, 09:59

whyohwhyohwhy's gravatar image

whyohwhyohwhy
11112
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×6
×4

question asked: 10 Sep, 09:59

question was seen: 1,723 times

last updated: 10 Sep, 09:59

powered by OSQA