Minimalist API for Accessing Data in OpenStreetMap Files using Java
This repository offers a .jar library OSMDatabase
that allows you to extract geographical data
from OpenStreetMap files easily, within only a few lines of code. All that it needs is a PBF format
OpenStreetMap file, and it will read all OSM Nodes, Ways, and Relations data from the file (or input stream).
1. Download the OSMDatabase.jar library or the source code, and include it in your project.
2. That's all you need! Now you can read PBF OSM files and get access to all its data.
--> please read this example to see how you can quickly extract data from an OSM file.
--> You can also download and read Javadoc file at SimpleOSM/OSMDatabase/Javadoc
for more information.
The source code is set up as an IntelliJ project. It requires the OSM4J-PBF library as its dependency. The OSMDatabase.jar comes with OSM4J-PBF version 0.1.0 built into it, so you don't need to download any other dependencies separately when using the library.
However, OSM4J's source code is not included in this repository. Therefore it is required to downloading and linking it with the source code manually (if IDE doesn't do it automatically) in order to compile the source code. See how you can download the latest version of OSM4J.
Note: downloading OSM4J from Maven is required since the OSM4J-PBF dependency listed on its Github Page download section does not seem to work.
This work is a combined library based on the OSM4J libraries developed by sebkur Sebastian and mojodna Seth Fitzsimmons. The aforementioned software is protected under version 3 of the GNU Lesser General Public License. You can find the source code, uncombined with any library facilities conveyed under the terms of LGPLv3 license, here. You can also find the accompanying uncombined form of OSM4J, the work which OSMDatabase is based on, through this link.