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

2
3

Hello

I'm trying to write a small android application that must be used offline.

Basically i need to find a lib to access osm data offline. I've read about PBF and OBF, and think they should be appropriate. But i'm having a hard time finding a lib.

I don't want to display the map or anything, i'd like to access raw data ... nodes, ways, relations ...

asked 13 Mar '13, 16:01

ZARk's gravatar image

ZARk
31122
accept rate: 0%

edited 14 Mar '13, 07:13

mmehl's gravatar image

mmehl
56521118


Osmosis can read pbf as well as osm, osm.gz and osm.bz2. I've posted example code on the forum a while ago. It's not 100% up to date but should give you a first impression how you could use it:

http://forum.openstreetmap.org/viewtopic.php?pid=213212#p213212

Additional features of Osmosis include filters and other pipeline elements to e.g. trim unwanted data while you are reading it. Osmosis is most commonly used as a stand-alone command line tool, but do not let that fool you: It is a decent choice as a Java library as well. I've used it in several of my projects.

However, I'm not an Android developer and do not know whether Osmosis works on Android. So take my recommendation with a grain of salt!

permanent link

answered 13 Mar '13, 19:36

Tordanik's gravatar image

Tordanik
12.0k15106147
accept rate: 35%

Hello Toranik !

Thanks for the link, i'm actually trying to build with your snippet i found when searching the forum.

But i'm actually having compilation issues when including the jar files from osmosis. So far it seems like the best solution (if I can compile on android with it)

(14 Mar '13, 16:16) ZARk

via wiki/O5m I found recently o5m4j ... a small java lib.

permanent link

answered 13 Mar '13, 17:11

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

The OSM wiki page has links to the protobuf code.

permanent link

answered 13 Mar '13, 16:50

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

edited 13 Mar '13, 17:37

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:

×181
×76
×60
×11
×2

question asked: 13 Mar '13, 16:01

question was seen: 16,277 times

last updated: 14 Mar '13, 16:28

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