I'm currently working on a project that requires me to get all nodes of the previous results with a certain tag.
The following code gets all nodes of the way, but I can't figure out how to only get the nodes with a certain tag.
[out:json][timeout:25];
(way["railway"="tram"](47.36889,8.55407,47.36973,8.55553));
out;
>;
//get all nodes within the result with a certain tag
out;
Try this query:
[out:json][timeout:25];
way["railway"="tram"](47.36889,8.55407,47.36973,8.55553);
>;
node._["public_transport"="stop_position"];
out;
It queries for all ways with a railway=tram tag in the given bounding box. Then it performs a recurse up (>;) to get all nodes of these ways . Afterwards it searches for nodes in the default set _ with a public_transport=stop_position tag.
Related
I want to find all ways containing a specific node. I do so with:
[out:json];
(
node(<NODE-ID>);
<;
);
out body;
Now is there a way to filter the result I got using the recurse up?
I would like to receive only ways and and only such which are available for cars.
I did it using a workaround. I took all ways close to the node coordinate and then recursed down, to also receive the nodes.
(
way[maxspeed](around:1,<lat>,<lon>);
>;
);
out geom;
I'm attempting to setup a Graph which allows a query to follow "Redirect" edges from one vertex to another.
Vertices can only have a single Redirect edge going out; however, there may be a chain of Redirects that occur before reaching the final destination.
I'm attempting to grab the final vertex using the traversedElement function; however, even when I strip my implementation down to a query as simple as
select traversedElement(-1) from (traverse out() from #15:2)
I'm receiving the following error:
java.lang.InstantiationException: com.orientechnologies.orient.core.sql.functions.coll.OSQLFunctionTraversedElement
I'm not sure what the best way to debug this one might be, the simplified query I'm attempting above appears to match the documentation faithfully (documentation example):
SELECT traversedElement(-1) FROM ( TRAVERSE out() from #34:3232 WHILE $depth <= 10 )
Any words of wisdom would be greatly appreciated, thanks!
There was an issue with traversedElement() on last release (fixed on 2.0.7-SNAPSHOT). However you can use traversedEdge() and traversedVertex() that works.
I'm trying to get all roads around a certain point. I'm using the following query:
(
way
(around:300,50.7913547,-1.0944082)
["highway"~"^(primary|secondary|tertiary|residential)$"]
["crossing"!~"."]
["name"];
>;
);
out;
I added the crossing exclusion because it kept including "markers" for crossings, and I'm only interested in roads.
However it seems to be ignoring the crossing and still plotting markers on the map, rather than just showing road outlines. This can be seen here.
These "nodes" that I don't want have the tags:
crossing=zebra
highway=crossing
which should fail my regex query, but it doesn't.
How do I get it to just return road plot lines, and none of these nodes/markers?
Sorry if my terminology is all wrong, I'm very new to this
The filter criterion you tried to use would only apply to the way itself rather than the nodes. Usually, a way wouldn't have a crossing tag, so this filter didn't have much of an effect on the final result. By using >; all of the nodes tags would shown up in the final result again.
I removed >; in your query and replaced out; by out geom; to only output the node lat/lon position without any tags.
You can try this out using the following link (currently pointing to overpass turbo beta)
Link
We have a bug at this CKEditor plugin, and a generic solution is like to this, applying a generic string-filter only to terminal text nodes of the DOM.
QUESTION: how (need code example) to traverse a selection node (editor.getSelection()) by CKEditor-4 tools, like CKEDITOR.dom.range?
First step will be to get ranges from current selection. To do this just call:
var ranges = editor.getSelection().getRanges();
This gives you an array of ranges, because theoretically (and this theory is proved only by Firefox) one selection can contain many ranges. But in 99% of real world cases you can just handle the first one and ignore other. So you've got range.
Now, the easiest way to iterate over each node in this range is to use CKEDITOR.dom.walker. Use it for example this way:
var walker = new CKEDITOR.dom.walker( range ),
node;
while ( ( node = walker.next() ) ) {
// Log values of every text node in range.
console.log( node.type == CKEDITOR.NODE_TEXT && node.getText() );
}
However, there's a problem with text nodes at the range's boundaries. Consider following range:
<p>[foo<i>bar</i>bo]m</p>
This will log: foo, bar, and bom. Yes - entire bom, because it is a single node and walker does not modify DOM (there's a bug in documentation).
Therefore you should check every node you want to transform if it equals range's startContainer or endContainer and if yes - transform only that part of it which is inside range.
Note: I don't know walker's internals and I'm not sure whether you can modify DOM while iterating over it. I'd recommend first caching nodes and then making changes.
I was wondering if it's possible to request via overpass API "any node that has at least one tag of any kind".
The only way I see right now is to sopecify all the existing tags in a huge union request (see below), or requesting nodes without the "tag filtering" at all, and getting many nodes that have no tag at all.
I will appreciate if you know a better solution.
Thanks!
[out:json];
(
node
["name"]
(50.6,7.0,50.8,7.3);
node
["amenity"]
(50.6,7.0,50.8,7.3);
AND SO ON (SPECIFY ALL THE OTHER TAGS)
);
out;
You can achieve this by using the following query:
[bbox:{{bbox}}];node[~"."~"."];out meta;
Example: http://overpass-turbo.eu/s/4Z4
Since version 0.7.54 you can also use the following approach:
[bbox:{{bbox}}];
node(if:count_tags() > 0);
out meta;
As far as I can see this is not possible at the moment. However you can post-filter the data using osmfilter / osmconvert.