| 1 | INSTALLING BBOX |
|---|
| 2 | --------------- |
|---|
| 3 | |
|---|
| 4 | DEPENDENCIES |
|---|
| 5 | ------------ |
|---|
| 6 | |
|---|
| 7 | * The Redland RDF toolkit. http://librdf.org/ |
|---|
| 8 | - Debian: apt-get install librdf redland-python |
|---|
| 9 | - *BSD: is in ports |
|---|
| 10 | - Fedora/RedHat: get RPMs http://download.librdf.org/binaries/ |
|---|
| 11 | |
|---|
| 12 | * Optional: PostGIS (which needs postgres): see INSTALLING POSTGIS |
|---|
| 13 | |
|---|
| 14 | * Some python modules: |
|---|
| 15 | - cheetah (template) : apt-get install python-cheetah |
|---|
| 16 | - pgdb (postgres): apt-get install python-pygresql |
|---|
| 17 | |
|---|
| 18 | CONFIGURATION |
|---|
| 19 | ------------- |
|---|
| 20 | |
|---|
| 21 | * Edit the file 'bbox/config.py' |
|---|
| 22 | |
|---|
| 23 | boot='file:/a/bootstrap/RDF/file' |
|---|
| 24 | # (See BOOTING A BBOX for details) |
|---|
| 25 | |
|---|
| 26 | store='/path/to/directory/' |
|---|
| 27 | # Where Redland stores its files |
|---|
| 28 | |
|---|
| 29 | db='filename' |
|---|
| 30 | # The name of Redland filestore ('bbox' by default) |
|---|
| 31 | |
|---|
| 32 | # *OPTIONAL* for the spatial index |
|---|
| 33 | |
|---|
| 34 | spatialdb='dbname' |
|---|
| 35 | # name of the PostGIS database or other spatial index |
|---|
| 36 | |
|---|
| 37 | utm_zone=31 |
|---|
| 38 | # find your zone at http://www.dmap.co.uk/utmworld.htm |
|---|
| 39 | |
|---|
| 40 | srid=32631 |
|---|
| 41 | # Spatial Reference ID for PostGIS; usually '326'+utm_zone |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | BOOTING A BBOX |
|---|
| 45 | -------------- |
|---|
| 46 | |
|---|
| 47 | * The data store needs to be 'booted' with knowledge about |
|---|
| 48 | RDF namespaces and short names for them. The file |
|---|
| 49 | 'store/boot.rdf' contains this knowledge. Run the script: |
|---|
| 50 | |
|---|
| 51 | bbox#> python store/boot.py |
|---|
| 52 | |
|---|
| 53 | If you don't go through the booting phase, the first time BBox runs, |
|---|
| 54 | it will boot itself but then fail, and only run the second time. |
|---|
| 55 | (It needs to know about namespaces before it can refer to them) |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | RUNNING A BBOX |
|---|
| 59 | -------------- |
|---|
| 60 | |
|---|
| 61 | BBox typically runs inside another application, though the |
|---|
| 62 | bbox/ui directory contains a proto standalone HTTP interface to it. |
|---|
| 63 | |
|---|
| 64 | Please see the file README for information on how to run a bbox. |
|---|
| 65 | |
|---|
| 66 | INSTALLING POSTGIS |
|---|
| 67 | ------------------ |
|---|
| 68 | |
|---|
| 69 | Currently in order to use the spatial index you need to be running a |
|---|
| 70 | PostGIS database, with a table in it mapping RDF nodes (URLs) to |
|---|
| 71 | geometries that can be queried spatially. |
|---|
| 72 | |
|---|
| 73 | Debian install: |
|---|
| 74 | |
|---|
| 75 | * append the following line to /etc/apt/sources.list |
|---|
| 76 | |
|---|
| 77 | deb http://pkg-grass.alioth.debian.org/debian-gis unstable main non-free contrib |
|---|
| 78 | |
|---|
| 79 | * run: |
|---|
| 80 | bbox#> apt-get update |
|---|
| 81 | bbox#> apt-get install postgis |
|---|
| 82 | |
|---|
| 83 | BSD install: PostGIS is in ports. You should be okay. I'd apprec feedback. |
|---|
| 84 | |
|---|
| 85 | Fedora/RH users: |
|---|
| 86 | |
|---|
| 87 | * RPMs available at http://mappinghacks.com/rpm/ |
|---|
| 88 | * install postgis* and postgres* from there. |
|---|
| 89 | |
|---|
| 90 | Source and documentation for PostGIS is available from |
|---|
| 91 | http://postgis.refractions.net/ |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | SETTING UP POSTGIS |
|---|
| 95 | ------------------ |
|---|
| 96 | |
|---|
| 97 | As the 'postgres' user, do the following |
|---|
| 98 | (where 'bbox' is the name of your database): |
|---|
| 99 | |
|---|
| 100 | postgres#> createdb bbox |
|---|
| 101 | postgres#> createlang plpgsql bbox |
|---|
| 102 | postgres#> psql bbox < /usr/share/doc/postgis/postgis.sql |
|---|
| 103 | postgres#> psql bbox < /usr/share/doc/postgis/spatial_ref_sys.sql |
|---|
| 104 | |
|---|
| 105 | The 'store' directory contains a file 'spatialStore.psql' |
|---|
| 106 | |
|---|
| 107 | You need to EDIT 'store/spatialStore.psql' and change the line that begins |
|---|
| 108 | 'SELECT AddGeometryColumn', which should read: |
|---|
| 109 | |
|---|
| 110 | SELECT AddGeometryColumn ('[your database name]','nodes','geom',[SRID],'GEOMETRY',2); |
|---|
| 111 | |
|---|
| 112 | Where SRID matches the SRID you set in bbox/config.py |
|---|
| 113 | Now load this file into your new database: |
|---|
| 114 | |
|---|
| 115 | postgres#> psql bbox < ~/bbox/store/node_geom.psql |
|---|
| 116 | |
|---|
| 117 | At this stage you might want to grant permissions to your webserver user: |
|---|
| 118 | |
|---|
| 119 | postgres#> psql bbox |
|---|
| 120 | bbox=> grant all on nodes to "www-data" # or apache or whoever |
|---|
| 121 | bbox=> grant select on geometry_columns to "www-data" |
|---|
| 122 | bbox=> grant select on spatial_ref_sys to "www-data" |
|---|