NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


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 clearly shows the first sector directed to the north-east, while its values are:



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):

""" 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 ="'(\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:
        toggle = not toggle


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 '18, 09:59

whyohwhyohwhy's gravatar image

accept rate: 0%

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 10 Sep '18, 09:59

question was seen: 77,755 times

last updated: 10 Sep '18, 09:59

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum