[OSM-dev] Query-Formats

Roland Olbricht roland.olbricht at gmx.de
Tue Mar 23 13:32:08 GMT 2010


Hello,

> I'm currently thinking about the interface on how to query this resource
> and i'd like to be able to ask queries like "all highway=trunk and
> highway=primary with a name" what is not possible with the current
> XAPI-Interface.

This would look like

<osm-script timeout="180">

<union>
  <query type="way">
    <has-kv k="highway" v="trunk"/>
    <has-kv k="name"/>
  </query>
  <query type="way">
    <has-kv k="highway" v="primary"/>
    <has-kv k="name"/>
  </query>
</union>
<print mode="body"/>

</osm-script>

in OSM3S. Bboxes for ways are possible but I haven't implemented them yet -
things that happen if a lonely guy develops a full blown multi-purpose server. 
This specific query is quite slow, because it returns data from across the 
entire planet.

> what do you think about supplying a raw SQL-Where via URL?
> 
> query.php?(tags ? 'name') AND (tags ? 'highway') AND ((tags->'highway' =
>    'primary') OR (tags->'highway' = secondary'))

I have thought about that when designing the interface, but I think it will be 
close to impossible to avoid
- extremely long running a resource intensive queries
- malicious queries (simple example ...'"; drop table *')
because SQL is simply not designed for to be offered over the web.

The second observation was that at least MySQL was way too slow to be useful - 
MySQL delivered about 10'000 nodes per minute, while OSM3S delivers roughly 
1'000'000 to 2'000'000 nodes per minute (for a query with is spatially local, 
like downloading all data from a city or county). From that starting point it 
looks unlikely that another general purpose DB engine would have a 
satisfactory performance.

Thus, I have preferred a query language with good predictability properties.  
See
http://78.46.81.38/#chapter.concepts
The server is productive and used for some services with the current language, 
but comment and also a deep refactoring of the language are welcome.

Cheers,

Roland




More information about the dev mailing list