Hi,

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: https://overpass-turbo.eu/s/13Hp

[out:json];
// Find all castles, for testing 
nwr
  [historic=castle][name~".*Trifels"]
  ({{bbox}});
map_to_area -> .a;

foreach.a->.elem(
  // find areas already in .final near the curreent element
  area.final(around.elem:200) -> .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, 08:04

cytrinox's gravatar image

cytrinox
1112
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:

×199
×61

question asked: 16 Feb, 08:04

question was seen: 218 times

last updated: 16 Feb, 08:04

powered by OSQA