NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi all,

i am developing an android app with which i display my current location and certain poi's, like cinema or restaurants around my position (inside a bounding box). i am using osmdroid and i can display my postion in a map, thats fine. but i have not any idea how to display the poi's (not in the map, i want the poi data as a sting). so what i want is to display the poi as a string in a textview, e.g. Textview: Cinemaxx. what do I need and how do I proceed? can anyone explain that to me? or gives a simple example code? i heard about a overpass-api, but I have not understood how to use it. should I use a different library e.g. mapsforge? I'm very desperate :( i hope someone can give me a very good hint and help me.

PS: sry for my english

asked 17 Dec '12, 10:27

naruto25's gravatar image

naruto25
16111
accept rate: 0%

When you do a query like Frederik told you, you get an XML file, and that can be read with one of the many XML libraries available for Java/Android. You can easily convert those XML nodes to Java objects, so you can work with those.

(17 Dec '12, 13:33) Sanderd17

There's two sides to your problem: You need a server that delivers the data and you need to display it in your client. I will talk only about the server side in this answer (due to lack of Android skills).

OpenStreetMap does not operate a server that would be suitable to make end-user queries like "what POIs are in this bbox" against. There are some third-party services that could be used, like XAPI or Overpass, however they all have their terms of use and limitations and you should not be using them in an application that you plan to distribute widely! You will have to set up your own server for that.

When queried, Overpass and XAPI will return data in OSM format. In the simple case of the POI being mapped as a point in OpenStreetMap, this would be a "node" object with a latitude and longitude, and some tags describing the name etc.; but the POI might also be a way or even relation in cases where it is mapped as an area in OSM.

There's a different, relatively new, third-party API that might suit you even better than Overpass and XAPI - see http://lists.openstreetmap.org/pipermail/talk-lu/2012-December/000099.html for the announcement. This allows you to download data in JSON format, but again, check with the operators before you make wide use of that.

permanent link

answered 17 Dec '12, 11:23

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

edited 17 Dec '12, 13:31

Sanderd17's gravatar image

Sanderd17
1.1k51637

thank u guys. i will try it. I'll get back if I get stuck :)

(17 Dec '12, 17:00) naruto25

Concerning Overpass API, you can boldly try. The relevant values (100'000 queries per day or 10 GB download data per day) have never been surpassed by any app. And the servers protect themselves, so you cannot hurt anybody. Severals apps make successfully use of Overpass API, and they have figures more around 1000 queries per day, 100-300 users, and less than 1 GB of download data.

In particular, there is an example website for mobile devices, http://overpass-api.de/locate_me.html which you can use as a starting point (however, it is written in JavaScript, not Java).

permanent link

answered 19 Dec '12, 08:47

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

edited 19 Dec '12, 09:44

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×535
×230
×181
×11
×9

question asked: 17 Dec '12, 10:27

question was seen: 5,420 times

last updated: 19 Dec '12, 09:44

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum