You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Yan 751981139f Get rid of some warnings about types 2 months ago
res regenerate using latest protoc plugin 1 year ago
LICENSE Add README & LICENSE; actually export some useful symbols 2 years ago
README.md oops, missed the `nibbles` dependency 2 years ago
fileformat.lisp Update some varint functions to match newer protobuf 2 months ago
osmformat.lisp I don't know what this fixes, but it's certainly something 2 months ago
osmpbf.asd Translate OSM tag names to symbols (to make lookups less worse) 2 years ago
osmpbf.lisp Translate tag values as well, if they're specified in a special variable 2 years ago
osmtypes.lisp Get rid of some warnings about types 2 months ago
packages.lisp Translate tag values as well, if they're specified in a special variable 2 years ago
tag-translation.lisp Translate tag values as well, if they're specified in a special variable 2 years ago

README.md

osmpbf, the Lisp OSM PBF format reader

What is this?

This library lets you read OpenStreetMap map data encoded in PBF format in the Common Lisp programming language, for whatever mapping-related needs you might have.

Implementation status

Basic support for reading nodes, ways, and relations is currently there (and it might even be somewhat performant; who knows!). Node metadata information is, however, not decoded yet.

How to use

Installation instructions

  1. Download the library, and put it somewhere ASDF can find it. (For example, git clone-ing the repo into ~/common-lisp/ should do the trick.)
  2. Install the dependencies com.google.base, protobuf, chipz, nibbles and flexi-streams. (If Quicklisp is installed, running (ql:quickload :osmpbf) should do this, and load the library as well!)
  3. If you didn't do it with Quicklisp above, run (asdf:load-system :osmpbf) and watch the compiler output scroll by.
  4. ???
  5. Profit!

Basic usage

Basically, you open your PBF file, specifying something like :direction :input :element-type (unsigned-byte 8), and pass the resulting stream to get-next-primitive-groups, repeating until you hit the end of the file.

CL-USER> (with-open-file (file "sample.pbf"
                               :direction :input
                               :element-type '(unsigned-byte 8))
           (osmpbf:get-next-primitive-groups file))
(#<OSMPBF:PRIMITIVE-GROUP nodes: (#<NODE #653970877 (51.7636027d0, -0.22875700000000002d0) tags: NIL>
                                  #<NODE #647105170 (51.76359050000001d0, -0.23446450000000002d0) tags: NIL>
                                  #<NODE #672663476 (51.7657492d0, -0.2290703d0) tags: NIL>
                                  #<NODE #241806356 (51.7689451d0, -0.23266170000000003d0) tags: NIL>
                                  ... snip ...)

The :element-type bit is important; if you leave it out, it'll yell at you. To figure out how to actually get useful things from the data returned, have a look at the goodies in the osmtypes.lisp file, and their associated documentation.

On that note...

Documentation

Is currently in the form of docstrings. Use the Source, Luke!

License

MIT