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


I want to build a query that returns for a given bbox:

  • List of POIs (one single node with coordinates) for all castles (historic=castle)
  • Some castles are mapped multiple times, for example: castle Trifels (Germany), so these rules should be applied:
  • If a single waypoint for historic=castle exists, this should be choosen
  • If not waypoint exists, the center of a way or relation should be used
  • Multiple mappings should be detected by a radius, as sometimes names are mapped different and thus a name can not be used as unique identifier.

In case of Trifels, there exists a way and a relation, both named different. But there is no single waypoint (node) for the castle.

Here is my code so far:

// Find all castles, for testing 
map_to_area -> .a;

  // find areas already in .final near the curreent element -> .deb;
  // get the nodes in this area, if any
  node(area.deb) -> .deb2;

  // if no nodes are in deb2, this is not a duplicate, so we can add it to .final
  if(.deb2.count(nodes) == 0) {
    (.elem; .final;) -> .final;

.final out center; // .final contains areas, so we need center to get a single waypoint

But this returns both areas. It seems that someting is going wrong with the count. And this code is not complete, as it as no weighting for nodes vs. ways vs. realations. It's just first come, first serve.

Can someone help me to understand how to build such a query?

asked 16 Feb '21, 08:04

cytrinox'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: 16 Feb '21, 08:04

question was seen: 790 times

last updated: 16 Feb '21, 08:04

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