Java& OpenStreetMap - 查询的执行时间

时间:2017-12-31 09:21:09

标签: java spring multithreading openstreetmap overpass-api

我正在做一个开放的链接数据应用程序,我正在从Open Street Map下载信息。我的应用程序在马德里的一些古迹周围创建路线,然后使用OSM在每个纪念碑周围获得餐馆,酒吧,电影院等。我正在使用的实际脚本就是这个:

<osm-script>
<query type="node">
  <around radius="150" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="pub"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="cafe"/>
</query>
<print limit="10"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="cinema"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="theatre"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="150" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="bar"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="250" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="restaurant"/>
</query>
<print limit="6"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="bicycle_parking"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="pharmacy"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="taxi"/>
</query>
<print limit="5"/>

<query type="node">
  <around radius="100" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="fast_food"/>
</query>
<print limit="7"/>

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="bank"/>
</query>
<print limit="10"/>  

<query type="node">
  <around radius="500" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="amenity" v="parking"/>
</query>
<print limit="12"/>

<query type="node">
  <around radius="200" lat="40.4188346862793" lon="-3.6948211193084717"/>
  <has-kv k="highway" v="bus_stop"/>
</query>
<print limit="8"/>  

</osm-script>

我在Java中创建了一个Thread对象,它使用指定的查询将带有RestTemplate对象的postForObject生成到http://overpass-api.de/api/interpreter。我对时间戳感到困惑,因为我得到了这个:

Time Overall for Download 40.427398681640625: 1945 milliseconds
Time Overall for thread Thread-14: 1959 milliseconds

Time Overall for Download 40.40608596801758: 1542 milliseconds
Time Overall for thread Thread-15: 1552 milliseconds

Time Overall for Download 40.41420364379883: 4082 milliseconds
Time Overall for thread Thread-16: 4093 milliseconds

Time Overall for Download 40.412384033203125: 4038 milliseconds
Time Overall for thread Thread-17: 4049 milliseconds

Time Overall for Download 40.41496658325195: 8187 milliseconds
Time Overall for thread Thread-18: 8198 milliseconds

更多线程,更多时间进行查询。我不明白。 有一种方法可以改善我的线程或改进查询吗?

提前致谢。

0 个答案:

没有答案