Clone this wiki locally
petiteReine is a lightweight application that displays bicycle parking on a small area (city, county), it is not fitted to manage data on a very large (or world-wide) basis. When you configure the app, you have to chosse what area it will display.
In order to run the app, the following software packages are required :
- PHP 5
- PostgresSQL with PostGIS extension (tested with PostgresSQL 9.3 and PostGIS 2.1, may work with older version as well)
A task scheduler such as cron may be useful as well, if want the data to be updated automatically.
Setting the database
Run the SQL script (res/DB.sql) to create the tables in your database
psql -u bilbo -d myBase -f res/DB.sql
Then modify the file conf.php, which defines the connection parameters (host, user, password, schema) :
// Database connection parameters
define('DB_HOST','localhost'); // host name
define('DB_USER','bilbo'); // DB user
define('DB_PASSWORD','topsecret'); // user password
define('DB_NAME','myBase'); // database name
Retrieving an area
The application data is fully based on OpenStreetMap, so the area we are going to display can be described as an OpenStreetMap relation (see administrative boundaries). This is the best method as OSM describes the local boundaries accurately.
The relation ID must be provided in conf.php
For instance, relation 7774 represents Paris in OpenStreetMap, with the city boundary. You can find your own relation in openstreeetmap.org with the search box, if you search for "London", you will find relation number 65606.
In many countries, administrative boundaries have not been described in OpenStreetMap yet. The area may be defined as a bounding box, as if you drew a rectangle on the map.
The bounding box is defined by four numbers : minimum and maximum latitude (south and north boundaries), minimum and maximum latitudes (west and east):
define('BBOX_NORTH',46.64118); define('BBOX_SOUTH',46.51351); define('BBOX_WEST',0.208053); define('BBOX_EAST',0.483398);
Distance and areas projection
In order to compute the distances and areas, the lon/lat coordinates are transformed into metric coordinates .
The script import.php is an import batch, it queries Overpass API for a dataset containing the bicycle parkings in the area you chose. You can invoke it using your web browser, by opening the URL http://myWebsite/import.php, or schedule it using cron (or any tool of your choice).
As soon as import.php is complete, the map is usable, and you can view the bicycle parkings.