- 0
OSM Overpass API with PHP-SimpleXML :: workin with the the OSM-Endpoint
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By Usama Jawad96 · Posted
Watchdog finds Microsoft guilty of confusing advertising when it comes to Copilot by Usama Jawad While Microsoft is advocating for Copilot usage in both personal and enterprise environments as much as possible, it arguably hasn't made as big of a splash as it wanted. Now, the U.S. watchdog National Advertising Division (NAD) has criticized Microsoft for some of its advertising practices when it comes to Copilot. In a recent blog post spotted by The Verge, NAD noted that Copilot does possess the functionalities that Microsoft expressly claims it does in enterprise use cases. This includes capabilities like summarization of content, generating text, and creating outlines for PowerPoint slide decks. While Copilot does have some limitations in this area, NAD thinks that they are pretty minor, so the lack of disclosure in this area doesn't really impact how most customers leverage Copilot. That said, the watchdog discovered some problems in Microsoft's messaging when it came to Business Chat. It believes that Redmond's universal and interchangeable use of Copilot for both the assistant and Business Chat can cause confusion among users, as they judge their functionalities. For example, NAD argues that while Copilot is quite fast at seamlessly generating documents in other applications, this is not the case with Business Chat, which requires more manual steps, and this is not abundantly clear in the advertising on Microsoft's website. Finally, NAD advised Microsoft to get rid of its claims regarding an increase in productivity and ROI because while the tech giant does have supporting studies to back its boasts, they do not provide a "good fit" for objective claims. It's also worth highlighting that the UK government recently did trial Copilot in work environments and discovered that participants did save 26 minutes per day on average. Still, it seems like this is not good enough for NAD. Interestingly, Microsoft did respond to NAD's advisory, saying that while it disagrees with some of the watchdog's findings, it has made changes to its advertising messages in order to comply with NAD's recommendations. Source: NAD via The Verge -
-
By excalpius · Posted
These are the same ignorant, gullible, cowardly fools who still believe that gods are real and that fictional White Jesus is coming back to Earth "any day now". It's a Venn-diagram of two almost perfectly concentric circles. In short, they'll buy anything you lie to them about as long as it makes them less afraid... Of things the rest of us know we don't have to be afraid of at all. -
By +sphbecker · Posted
It isn't fair to shift all blame to the user. Yes, the user shouldn't have blindly trusted MS with all their data, but assuming the facts reported are correct, MS massively screwed up too. Both can be true. -
By excalpius · Posted
How about with add up/down votes on posts instead? Then we could upvote posts that are True based on the facts and supported by evidence. And we could also downvote the ridiculous paranoid rantings of ignorant, gullible, cowardly people who still fall for ancient proven lies and obvious fearmongering scams behind such nonsense like white supremacy, Nazism, Trumpism, etc. I'm willing to give it a try. How about you?
-
-
Recent Achievements
-
dismuter went up a rank
Experienced
-
mevinyavin earned a badge
One Month Later
-
rozermack875 earned a badge
Week One Done
-
oneworldtechnologies earned a badge
Week One Done
-
matthiew went up a rank
Veteran
-
-
Popular Contributors
-
Tell a friend
Question
tarifa
good day dear programmers, dear experts here at Neowin,
i am currently working on a parser that gets data via OSM Overpass API with PHP-SimpleXML. I am workin with the pretty new to the work with PHPSimpleXML so do not bear with me for askin newby questions. I am tryin to get data using Open Street Maps. I want to write a code that works with the endpoint of openstreetmap - and the given data is the starting point for further explorations. My tactic is as follows:
I fetch data from the openstreetmap-endpoint
1. i run requests to the openstreetmap-endpoint- (see below) and i try three different APIs per request isn't that easy on ressources and
2. I don't know how to work with the results that i gather from the OpenStreetmap-Endpoint
see the request:
This is derived from here: http://stackoverflow.com/questions/16129184/osm-data-parsing-to-get-the-nodes-with-child
I want to filter the data to get the nodes with special category. Here is sample of the OSM data I want to get the whole schools within an area. The first script runs well - but now i want to refine the search and add more tags. Finally i want to store all into the MySQL-db
So we need to make some XML parsing with PHP:
The following is a little OSM Overpass API example with PHP SimpleXML
The second part is more interesting. That is querying the XML data you have already. This is most easily done with xpath, the used PHP XML library is based on libxml which supports XPath 1.0 which covers the various querying needs very well. The following example lists all schools and tries to obtain their names as well. I have not covered translations yet because my sample data didn't have those, but you can also look for all kind of names including translations and just prefer a specific one):
The key point here are the xpath queries. Two are used, the first one to get the nodes that have certain tags. I think this is the most interesting one for you:
//node[tag[@k = "amenity" and @v = "school"]]
This line says: Give me all node elements that have a tag element inside which has the k attribute value "amenity" and the v attribute value "school". This is the condition you have to filter out those nodes that are tagged with amenity school. Further on xpath is used again, now relative to those school nodes to see if there is a name and if so to fetch it:
tag[@k = "name"]/@v'
This line says: Relative to the current node, give me the v attribute from a tag element that as the k attribute value "name". As you can see, some parts are again similar to the line before. I think you can both adopt them to your needs. Because not all school nodes have a name, a default string is provided for display purposes by adding it to the (then empty) result array:
list($name) = $school->xpath('tag[@k = "name"]/@v') + ['(unnamed)']; ^^^^^^^^^^^^^^^ Provide Default Value
so far so good: note. i need to have the adress-data, of the school with
cf http://wiki.openstreetmap.org/wiki/Key:addr
and even more important
cf http://wiki.openstreetmap.org/wiki/Key:contact
btw. here my results for that code-example:
martin@linux-70ce:~/php> martin@linux-70ce:~/php> php osm1.php Query returned 1691 node(s) and took 3.34569 seconds. 23 School(s) found: #00: ID:332534486 [39.5017565,16.2721899] Scuola Primaria #01: ID:1428094278 [39.3320912,16.1862820] (unnamed) #02: ID:1822746784 [38.9075566,16.5776597] (unnamed) #03: ID:1822755951 [38.9120272,16.5713431] (unnamed) #04: ID:1903859699 [38.6830409,16.5522243] Liceo Scientifico Statale A. Guarasci #05: ID:2002566438 [39.1349460,16.0736446] (unnamed) #06: ID:2056891127 [39.4106679,16.8254844] (unnamed) #07: ID:2056892999 [39.4124687,16.8286119] (unnamed) #08: ID:2272010226 [39.4481717,16.2894353] SCUOLA DELL'INFANZIA SAN FRANCESCO #09: ID:2272017152 [39.4502366,16.2807664] Scuola Media #10: ID:2358307794 [39.5015031,16.3905965] I.I.S.S. Liceo Statale V. Iulia #11: ID:2358307796 [39.4926280,16.3853662] Liceo Classico #12: ID:2358307797 [39.4973761,16.3858275] Scuola Media #13: ID:2358307800 [39.5015527,16.3941156] I.T.C. e per Geometri #14: ID:2358307801 [39.4983862,16.3807796] Istituto Professionale #15: ID:2358344885 [39.4854617,16.3832419] Istituto Tecnico Statale Commerciale G. Falcone martin@linux-70ce:~/php>
note. i need to have the adress-data, of the shool with
and even more important http://wiki.openstreetmap.org/wiki/Key:contact
How to add this .. into the query? and how to finally store all into the MySQL-db?
update: can i rework like so:
$xml = file_get_contents($url); $data = new SimpleXMLElement($xml); $data variable contains the following: SimpleXMLElement Object ( [@attributes] => Array ( [timestamp] => Sat, 15 Jun 13 20:02:13 +0000 [attribution] => Data Š OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright [querystring] => Bucharest-Romania [polygon] => false [exclude_place_ids] => 331526 [more_url] => http://nominatim.openstreetmap.org/search?format=xml&exclude_place_ids=331526&q=Bucharest-Romania ) [place] => SimpleXMLElement Object ( [@attributes] => Array ( [place_id] => 331526 [osm_type] => node [osm_id] => 96209423 [place_rank] => 15 [boundingbox] => 44.4361381530762,44.4361419677734,26.1027431488037,26.1027450561523 [lat] => 44.436139 [lon] => 26.1027436 [display_name] => BucureČti, Sector 2, Bucuresti, România, European Union [class] => place [type] => city [importance] => 0.73231672860554 [icon] => http://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png ) ) )
dear friends, look forward to hear from you
Link to comment
https://www.neowin.net/forum/topic/1389708-osm-overpass-api-with-php-simplexml-workin-with-the-the-osm-endpoint/Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now