aboutsummaryrefslogtreecommitdiffstats
path: root/README
blob: a11a09b671d59696cd2b800a94c5d90e159461c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
===============
osm@spline Xapi
===============

Aim
============

We like to rewrite some parts of the XApi needed for our own application. Our 
aim is not get a full implementation of the Xapi, but to answer only specific 
requests, at low latency. For this subset of Xapi we want completly cover the 
original api. 

Requests
=============

This is a list of example requests, we want to optimize.

* xapi.spline.de/api/0.6/node[amenity=*]
* xapi.spline.de/api/0.6/node[highway=busstop]
* xapi.spline.de/api/0.6/node[bbox=-6,50,2,61]
* xapi.spline.de/api/0.6/node[amenity=hospital][bbox=-6,50,2,61]

a more formal description
-------------------------

We serve the node endpoint, but no others. We implment the tag based filtering,
for only one tag and a bounding box.

Dabase setup
=============

We use postgres 9.* with postgis 1.5. Postgres 9.0 is used becaus we need some
functions on hstores and postgis 1.5 is used for fancy geometry things.

To setup a database you first need a runing postgres 9.0 instance. I hope you know
how to do this. 

Use 

	createdb osm

to create a database with name osm. Use 

	createlang plpgsql osm

to add plpgsql to your database. If you want to create a database user do so:

	createuser <username>

Add hstore support for your database:

	psql -d osm < /share/contrib/hstore.sql

Add postgis support for your database:

	psql -d osm < /share/contrib/postgis-1.5/postgis.sql

Just do:

	psql -d osm < /share/contrib/postgis-1.5/spatial_ref_sys.sql

Create the actual schema for osm data. For this step you need osmosis. If your 
osmosis build is correct there should be a directory named pacakge/scripts where
you run:

	psql -d osm < pgsql_simple_schema_0.6.sql
	psql -d osm < pgsql_simple_schema_0.6_linestring.sql
Optional/stil to test:

	psql -d osm < pgsql_simple_schema_0.6_action.sql
	psql -d osm < pgsql_simple_schema_0.6_bbox.sql 

For documentation on the schema read pgsql_simple.txt.

Import data from xml with:

	osmosis --read-xml file="planet.osm.bz2" --wp host="localhost" password="TopSecretPassword" user="insertUserNameHere" database="osm"

Before or after import you may want to create a index or two. Examples below:
	CREATE INDEX idx_nodes_tags ON nodes USING GIN(tags);	
	CREATE INDEX idx_nodes_tags ON nodes USING GIST(tags);
	CREATE INDEX idx_ways_tags ON ways USING GIN(tags);
	CREATE INDEX idx_ways_tags ON ways USING GIST(tags);

database shema (out dated)
================

We keep data in a highly specioaliced shema, that allows us to prevent tables
growing to big. And supports our requests at maximum speed. 

|  CREATE TABLE <tagname>:<tagvalue> (
|       {bigint id}
|       {longitude float4},
|       {latitude float4},
|       {object varchar}
|  ) PRIMARY KEY id;

Implmentation
=============

Teilprobleme:
..............

1. Database import

mögliche Technologien:
* Osmosis- plugin
* selbst in python (Protobuf consumer, async pgsql schreiber)


2. Web API
..............

mögliche Technologien:
* node.js