How to extract osm poi categories - openstreetmap

This is an example of osm xml:
<node id="1000" ...>
...
<tag k="shop" v="supermarket"/>
</node>
<node id="26999673" ...>
...
<tag k="public_transport" v="station"/>
<tag k="railway" v="station"/>
<tag k="train" v="yes"/>
</node>
I know that "shop", "railway", "station" are poi categories, because I am human. But how can I extract them by script?

You can try this: https://github.com/kiselev-dv/gazetteer it will generate JSON with addresses, and pois also with address. Pois are categorized according to https://github.com/kiselev-dv/osm-doc so you can define your own POI types.

That entirely depends on your interpretation of POI which is a very broad term.
Mappers in OSM are allowed to use any tags they like. Consequently there is no such thing as a POI category. But there are many frequently used tags of which most are documented at the map features wiki page.

Related

GPS to way id matching in OpenStreetMaps

I have a problem like this: I have a list of latitude, longitude pairs and for each one of those, I would like to know which type of road was it generated on.
All the points are from GPS units of cars driving on public roads.
I have downloaded OpenStreetMap .osm export, where the roads are stored in a format as follows:
<way id="88596345" visible="true" version="9" changeset="453983438" timestamp="2017-05-04T15:47:48Z" user="wegavision" uid="453845">
<nd ref="456877786"/>
<nd ref="3335483999"/>
<nd ref="248335839"/>
<nd ref="406453920"/>
<nd ref="25808860"/>
<tag k="destination" v="abcd"/>
<tag k="highway" v="secondary"/>
<tag k="lanes" v="1"/>
<tag k="lit" v="yes"/>
<tag k="maxspeed" v="30"/>
<tag k="oneway" v="yes"/>
<tag k="ref" v="M54"/>
<tag k="sidewalk" v="left"/>
<tag k="smoothness" v="good"/>
<tag k="surface" v="asphalt"/>
</way>
Now my question is, is there any tool to find a match between GPS coordinates and this way ids? How is this done using OpenStreetMaps?
Okay, so in the end I figured it out as follows:
First, I have installed an Overpass API on my Ubuntu machine and loaded the downloaded .osm there. Then I could query the loaded .osm file like this:
/some_path/osm-3s_v0.7.54/bin/osm3s_query --db-dir=/some_path/osm-3s_v0.7.54/mydb <<< "way['highway'](around:10,'_GPSLAT_,_GPSLON_');out;"
This returned an XML string where I could parse for a way id.
The major issue with this approach is that when your GPS point is close to multiple roads, you get an XML response with multiple way ids. In my solution I have totally neglected this and I am fine with any error this might give. Since my dataset is very large and dense I assume the error made would not be significant and early experiments proved me right.

T-SQL : getting the column descriptions into a XMLSCHEMA

I have a query where I generate a XMLSCHEMA and a XML sample.
SELECT TOP (10)
filename, queue, owner, resubmitFile,
pages, system, created, server, preflightlogs, status, kit, totalkits
FROM
Preflight_analytics
FOR XML AUTO, XMLSCHEMA ('Preflight_analytics')
All my columns have a description associated with it.
Is it possible to get the column description place inside the xsd like the below sample? I use the xsd to generate documentation and the tool I use, uses the tag <xsd:documentation> to add the description to the docs - like below:
<xsd:attribute name="JobID" fixed="" use="required">
<xsd:annotation>
<xsd:documentation xml:lang="en">Vendors unique ID</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="sqltypes:varchar" sqltypes:localeId="1033"
sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth"
sqltypes:sqlSortId="52">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute
I been looking over the docs here haven't found anything yet but still looking.
Thank you
Mike

Qlikview REST connector pagination namespaced XML

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!
Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);
This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.

Objects are missing in WADL

I have a web application using Jersey, and I would like to describe its' REST API with WADL.
Jersey generates .wadl file by default, but it does not contain objects (some of my REST calls send/return objects). Actually, I get something like this:
<method id="save" name="POST">
<request>
<representation mediaType="application/json"/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
How can I create .wadl that describes also objects?
Acceptable and returned types are described by XML Schema only when you are accepting/returning application/xml type. There is no generally accepted description of JSON types or structures, so WADL generated from Jersey doesn't contain related description (simply because there is no standard way how to achieve that).

iPhone: How to handle Core Data relationships

I'm new to Core Data and databases in general. Now I need to parse a XML and store the contents in Core Data. The XML looks something like this:
<books>
<book id="123A" name="My Book">
<page id="95D" name="Introduction">
<text id="69F" type="header" value="author text"/>
<text id="67F" type="footer" value="author text"/>
</page>
<page id="76F" name="Chapter 1">
<text id="118" type="selection">
<value data="1">value1</value>
<value data="2">value2</value>
<value data="3">value3</value>
</text>
</page>
</book>
<book id="124A"...
From my understanding I would need four Entities, like "Books", "Book", "Pages" and "Text". I wonder how to set the relationships correctly and how to add for example a Page object to a Book object and how to retrieve a Text object attribute's value? The tutorials I have found mostly deal with one Entity so I didn't really get the idea.. Gtrateful for any help!
No, you'd need three entities. You can think of "Books" as the CoreData database you're using. The CoreData database then includes a number of entities called book.
I think the data model you have is a bit weird, but I guess it makes sense for your application. To map it to CoreData I would:
Add the entities Book, Page, Text
Add a bookId, pageId, textId to them, respectively.
Then add a relation from Page to Book, and from Text to Page.
By then you should be able to print out a whole book by asking for all Pages that have
Book = the book you're interested in
and then order all those Pages by their pageId
and in order, ask for all texts that have
Page = the current page
then order those Texts by their textId.
What might be a problem is that a Text can have multiple Values, as seen in your XML above. You could use this by adding another entity called Value, but I would probably solve it by adding the attributes "value" and "type" to the Text entity directly. (You could then use "value" as a second sort key when printing out a page.
Check out these links:
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/CoreData/
http://developer.apple.com/cocoa/coredatatutorial/index.html (for regular Cocoa, but the same principles hold so this should help)