osm-oscar / pyoscar

Python interface to liboscar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup

Cloning

git clone --recursive https://github.com/dbahrdt/pyoscar

Updating

git --rebase pull && git submodule update && git submodule foreach --recursive git submodule update

Don't forget to rebuild the library

Pre-requisites

Remember to install the development files well. On Debian the relevant packages usually have a "dev" suffix.

  • Python 3
  • Boost-Python
  • zlib-dev
  • CGAL
  • cryptopp
  • icu
  • ragel
  • cppunit

building

mkdir build
cd build
cmake ../
make

Sample data

Sample data files can be found here:

http://data.oscar-web.de/

For the germany data set, download all files from: http://data.oscar-web.de/archive/de/

place them in a single folder:

export OSCAR_DATA_PATH=your_path

cd ${OSCAR_DATA_PATH}
wget http://data.oscar-web.de/archive/de/index
wget http://data.oscar-web.de/archive/de/kvstore
wget http://data.oscar-web.de/archive/de/textsearch

Using pyoscar

Load the package:

import pyoscar

Load the data

import pyoscar
import os

hdl = pyoscar.MainHandler()
hdl.energize(os.environ['OSCAR_DATA_PATH'])

Issuing a query

engine = hdl.engine()
result = engine.query("@highway in Stuttgart")

Getting all cells

cells = result.cells()

Getting all item ids

items = cells.items()

Get the real item

store = cmp.store()
for itemid in items:
	item = store.at(itemid)
	#do something?

Semantics

The Graph and the Store

OSCAR uses two ids to reference items and regions. The store is indexed using an itemId whereas the Inclusion-Dag/Graph is indexed using a graphId. Conversion between the two is only necessary for regions and is possible by using the functions pyoscar.GeoHierarchy.itemId2GraphId and pyoscar.GeoHierarchy.graphId2StoreId respectivley.

About

Python interface to liboscar


Languages

Language:C++ 93.0%Language:CMake 4.7%Language:Python 2.3%