hi danke
die großen Zusammenhänge mach ich mir mal später (heut abend klar)
...brauchen mehr tags hier...
BTW: wie im Threadstart bemerkt sind es ja Anfragen an dem Overpass-Endpoint:
hier:
hier die kpl. Abfragen:
oder auch dieser untenstehenden - wo mehr als 2000 records /(resultate ) herauskommen.
Da stellt sich natürlich die Frage - in manchen sind viele in manchen sind wenige Values zu den k attributen vorhanden.
und da sind dann unterschiedl. Mengen an Werten ( vorhanden)...
Die es interessanterweise herauszuholen gilt....
meld mich heut abend wieder
vg dilbert
update: es geht mir um ein catch all nodes ...
vgl.
... this selects any node (of type document node /, element node, text node, processing instruction node and comment node) and any attribute node and any namespace node -- that is all nodes because there are no other types of nodes. How you access the obtained XmlNodeList containing the selected nodes depends on the API of the specific XPath engine you are using -- read and use your documentation.
vgl auch hier: http://stackoverflow.com/questions/8...ath-expression
What is the xpath expression to select all nodes of a document?
Given this example XML:
It contains three nodes: <div> (element), class= (attribute) and "header" (text).
I tried with
which returns all element nodes only
(I assume because of //).
Is there a way to add other nodes
like attributes and textnodes in attribute values?
Zitat von tr0y
Beitrag anzeigen
die großen Zusammenhänge mach ich mir mal später (heut abend klar)
PHP-Code:
$result = $dom->xpath("node[tag/@k='amenity' and tag/@v='school']");
BTW: wie im Threadstart bemerkt sind es ja Anfragen an dem Overpass-Endpoint:
hier:
PHP-Code:
$endpoint = 'http://overpass-api.de/api/interpreter';
PHP-Code:
<?php
/**
* OSM Overpass API with PHP SimpleXML / XPath
*
* PHP Version: 5.4 - Can be back-ported to 5.3 by using 5.3 Array-Syntax (not PHP 5.4's square brackets)
*/
//
// 1.) Query an OSM Overpass API Endpoint
//
$query = 'node
["amenity"~".*"]
(38.415938460513274,16.06338500976562,39.52205163048525,17.51220703125);
out;';
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => ['Content-Type: application/x-www-form-urlencoded'],
'content' => 'data=' . urlencode($query),
]]);
# please do not stress this service, this example is for demonstration purposes only.
$endpoint = 'http://overpass-api.de/api/interpreter';
libxml_set_streams_context($context);
$start = microtime(true);
$result = simplexml_load_file($endpoint);
printf("Query returned %2\$d node(s) and took %1\$.5f seconds.\n\n", microtime(true) - $start, count($result->node));
//
Da stellt sich natürlich die Frage - in manchen sind viele in manchen sind wenige Values zu den k attributen vorhanden.
PHP-Code:
<?php
$query = 'node
["addr:postcode"~"RM12"]
(51.5557914,0.2118915,51.5673083,0.2369398);
node
(around:1000)
["amenity"~"fast_food"];
out;';
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => ['Content-Type: application/x-www-form-urlencoded'],
'content' => 'data=' . urlencode($query),
]]);
$endpoint = 'http://overpass-api.de/api/interpreter';
libxml_set_streams_context($context);
$result = simplexml_load_file($endpoint);
printf("Query returned %2\$d node(s) and took %1\$.5f seconds.\n\n", microtime(true) - $start, count($result->node));
}
Die es interessanterweise herauszuholen gilt....

meld mich heut abend wieder
vg dilbert

update: es geht mir um ein catch all nodes ...
vgl.
PHP-Code:
//node() | //@* | //namespace::*
vgl auch hier: http://stackoverflow.com/questions/8...ath-expression
What is the xpath expression to select all nodes of a document?
Given this example XML:
PHP-Code:
<div class="header"/>
PHP-Code:
$doc = new DOMDocument;
$doc->loadXml('<div class="header"/>');
$xpath = new DOMXPath($doc);
PHP-Code:
//node():
PHP-Code:
$xpath->query('//node()');
(I assume because of //).
Is there a way to add other nodes
like attributes and textnodes in attribute values?
Kommentar