Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ Underpass-API aim to be a [Overpass-API](https://github.com/drolbr/Overpass-API)

## Prepare the data & Run the server

Folow the instruction of one of the backends:
### With docker (recommended)

Follow the instruction of one of the backends:
* [Postgres+PostGIS / Osmosis](backends/postgres_osmosis/README.md), Osmosis schema
* [DuckDB+Spatial / QuackOSM](backends/duckdb_quackosm/README.md), Quackosm schema

### Without docker

It is possible to use Underpass-API without docker with the following instructions :

* declare environment variables (add new lines in `~/.bashrc` or `~/.profile` then reload with `source ~/.bashrc`) :
- DuckDB+Spatial / QuackOSM: `export BACKEND="DuckdbQuackosm"` and `export DB="/data/database.parquet"`
- Postgres+PostGIS / Osmosis: `export BACKEND="PostgresOsmosis"` and `export "DATABASE_URL='postgresql://user:pw@host:5432/database"`
* install software : `bundle install`
* start server : `bundle exec rackup`

## Query

The API as available at http://localhost:9292/interpreter
Expand Down
15 changes: 12 additions & 3 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ require 'bundler/setup'
require 'hanami/api'
require 'overpass_parser'
require 'json'
require_relative 'backends/postgres_osmosis/postgres_osmosis'
require_relative 'backends/duckdb_quackosm/duckdb_quackosm'
case ENV['BACKEND']
when 'DuckdbQuackosm'
require_relative 'backends/duckdb_quackosm/duckdb_quackosm'
when 'PostgresOsmosis'
require_relative 'backends/postgres_osmosis/postgres_osmosis'
end

class App < Hanami::API
def initialize
super
@@backend = ENV['BACKEND'].constantize.new
@@backend = case ENV['BACKEND']
when 'DuckdbQuackosm'
DuckdbQuackosm.new
when 'PostgresOsmosis'
PostgresOsmosis.new
end
end

helpers do
Expand Down