[OSM-dev] XAPI and using a home server

Roland Olbricht roland.olbricht at gmx.de
Tue Mar 1 01:05:47 GMT 2011


> Roland,
> I have compiled osm3s and imported the latest planet file.

Thank you for this. I'm sorry that there are still holes in the instructions.

> I think this
>  was successful - no errors anyway and took about 24 hours as you suggested
>  and ended with
[...]
> > max_written_role_id 4458
> > R 1298757941 r 1298757941
> 
> This looks a bit abrupt, but I tried a small osm file and got a similar
> result, so I think this is a good sign?

Yes, it is. It looks fine so far. Well, the next version will have a more 
informative final message.
 
> How do I use it?

> And although it lets me type things at the terminal (like your example
> queries), it does not respond - is it really listening on standard input?

Yes, it does. It waits until the input stream is finished. So, please finish 
the input stream by Ctrl+D when you type at the console (works in general on 
all UNIX consoles).

A more convenient way (especially when invoking it in a tool chain) might be 
to pass a file with the content to it. For example

echo '<query type="node"><bbox-query n="51.0" s="50.9" w="6.9" e="7.0"/><has-
kv k="amenity" v="pub"/></query><print/>' | bin/osm3s_query --no-mime --db-
dir=YOUR_DB_DIR

> Your instructions on the wiki say "put a query on the standard input", but
> when I start osm3s_query it prints out:
> > encoding remark: No input found from GET method. Trying to retrieve input
> > by POST method.

You can safely ignore the message if you call osm3s_query on the command line. 
It's a leftover from the purpose of using it via the CGI interface of a web 
browser.

> Sorry if this is obvious - I haven't tried to look at your code to see what
> it is doing!

Questions are always welcome. Even if it were obvious (it is not), it is still 
a good hint for me how to improve the instructions.
 
> The other question is whether anyone has written a php script (or similar)
> to make this emulate xapi queries to use as a direct replacement for xapi?

AFAIK no yet. I think it would be feasible for

/map?bbox=..
(gets '<bbox-query n="" s="" w="" e=""/><print/>')

/node[..] (with or without bbox)
(like the first query in the instructions, maybe without bbox)

/way[..]
(gets '<query type="way"><has-kv k="" v=""/></query><print/>'
 or maybe '<query type="way"><has-kv k=""/></query><print/>'

/relation[..]
(gets '<query type="relation"><has-kv k="" v=""/></query><print/>')

/*  (all three without bbox)
(gets:
  <union>
    <query type="node"><has-kv k="" v=""/></query>
    <query type="way"><has-kv k="" v=""/></query>
    <query type="relation"><has-kv k="" v=""/></query>
  </union>
  <print/>
)

but the other queries may get more difficult.

Cheers,

Roland



More information about the dev mailing list