Microcosm

From OpenStreetMap Wiki
Jump to: navigation, search
Help
Available languages
English Русский

Microcosm is a map database server implemented in PHP. The main goals are to implement API v0.6 on a platform that is easy and convenient, particularly with respect to hosting and installation. It can only handle small databases, unlike the Rails Port. All the API calls are supported, but many features are still lacking. The back end database uses SQLite, but the software is designed to be extensible to other back ends. Microcosm is compatible with JOSM and Merkaartor, but not tested using Potlatch.

Sqlite must be compiled with R*Tree enabled, but this seems to be the default for some linux distributions (e.g. Debian and Ubuntu). Notably, CentOS is NOT compiled with R*Tree enabled. CentOS is widely used in shared hosting and makes running Microcosm problematic in these circumstances.

The license is simplified BSD. Send comments and suggestions to TimSC.

Contents

Issues with Running Independent Servers

Installation

sudo apt-get install libapache2-mod-php5 php5-sqlite
php import.php map.osm

Configuring Default /api/0.6 Url using mod_rewrite

The simple installation of microcosm has a URL ending in "php". Sometimes it is preferable to have the more conventional /api/0.6 URL for the API. This may be achieved on apache using mod_rewrite. This enables requests to the /api/0.6 to be redirected to the PHP script.

sudo a2enmod rewrite
sudo apachectl restart

nginx config

location /api/ {
   fastcgi_pass unix:/var/spool/php-fpm.socket; # PHP-FPM socket
   root   /home/web/htdocs/m/; # Microcosm directory
   fastcgi_index microcosm.php;
   include        fastcgi_params;
   fastcgi_split_path_info ^(\/api)(.*)$;
   fastcgi_param SCRIPT_FILENAME $document_root/microcosm.php;
   fastcgi_param PATH_INFO $fastcgi_path_info;
}

lighttpd config

url.rewrite = ( "^/api/(.*)$" => "m/microcosm.php/$1" )

Enable PHP Debug Messages

To trouble shoot PHP scripts, it is often helpful to have errors turned on. Edit your php.ini (for me it is /etc/php5/apache2filter/php.ini) and set:

display_errors = On

and restart apache:

sudo apachectl restart

Upgrading Versions

Because there is no system of schema updates, the database should be exported, then a clean install used to import the data.

Download

[2]

Personal tools
Namespaces
Variants
Actions
site
Toolbox