Surveillance Under Surveillance
- PHP 64.2%
- JavaScript 27%
- Shell 8.4%
- Hack 0.4%
| init_cameras | do not assume username and database name | |
| update_cameras | m. remove closing tags from includes, to avoid potential whitespace outputs | |
| www | m. remove closing tags from includes, to avoid potential whitespace outputs | |
| .gitignore | Added news on the main page | |
| COPYING | Initial commit | |
| README.md | - Include the Leaflet.iconlabel files since there is now a license | |
osmcamera
This project contains the source code for the map initially displayed at http://osm-camera.tk. This site is now closed.
This code has been reused and improved by at least 3 people who operate the following sites:
- http://osmcamera.dihe.de/
- https://sunders.uber.space (code: https://github.com/rauhkrusche/sunders)
- https://lgms.nl/p/osm/sus (code: https://codeberg.org/lucg/sus)
Installation
-
Set up a LAMP server on which the application will be installed
-
Setting up the database structure
- Create a database, e.g. called "camera"
- Run
init_cameras/db/createDb.sqlwithin your database, e.g.:mariadb -h localhost -u root -p < createDb.sql - Create a user, e.g.
camselect, and give it onlySELECTpermissions on the database, e.g.:GRANT SELECT ON camera.* TO camselect@localhost;
- Initializing the cameras in the database
rqt.sqlcontains the camera data from the first ODbL planet file (2012年09月14日), which you can import using, e.g.:mariadb camera -h localhost -u root -p < rqt.sql- As an alternative, you may download your own planet or an extract, and get the cameras from it:
- download the file or an extract and put it in the
init_camerasdirectory. You may download extracts, like Monaco (which is easier to perform tests) at http://www.geofabrik.de/data/download.html. Or you may download a full planet file from the torrent found at ftp://ftp.spline.de/pub/openstreetmap/torrents/. - execute
extraitVideosurv.sh(that script requires osmosis: see wiki.osm.org/wiki/Osmosis/Installation). It will create asurveillance.osmfile and arqt.sqlfile. This may be long. - then execute the following command:
mariadb camera -h localhost -u root -p < rqt.sql
- download the file or an extract and put it in the
- Set up automatic updating of the camera data
- Enter the
update_camerasdirectory - The automatic update is based on the
sequenceNumbercomparison between the currentstate.txtfrom the replicate server, and the locally storedlastState.txt. So if you downloaded a planet file, you should modifysequenceNumberinlastState.txtfile accordingly. - Copy or rename
config.php.exampletoconfig.phpand set the values you wish - Create directory
update_cameras/logs - Add the update script to your crontab. Execute
crontab -eand enter the following line: -
-
-
-
- /path/to/update_cameras/update_camera.sh > /dev/null 2>&1
-
-
-
* Once it executes (after one minute), you'll see that the update script creates log files in the `update_cameras/logs` directory
4. Set up the application on the apache server
* Copy or rename `config.php.example` to `config.php` and set the values you wish
* Copy the www directory content to your `DocumentRoot` location, e.g. `/var/www` (depending on your distribution and setup). If you want to set up a new virtual host, here is the one I use:
```xml
<VirtualHost *:80>
ServerAdmin contact@osm-camera.tk
ServerName www.osm-camera.tk`
ServerAlias osm-camera.tk *.osm-camera.tk
DocumentRoot /var/www/camera
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/camera>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Credits
- OpenStreetMap and contributors: all data displayed by osm-camera.tk are from OSM: the tiles are from Mapnik (license CC-by-sa), and the camera info is extracted directly from OSM (license Odbl).
- Switch2osm: you may recognize some little parts of their code, as I initialised the leaflet stuff from this page: http://switch2osm.org/using-tiles/getting-started-with-leaflet/
License: CC-by-sa (so I'm bound to license the leafletembed.js file under that licence) - Leaflet, by cloudmade: the map is based on the leaflet API (linked from the index.php. I don't care the licence as I don't redistribute it...)
- IconLabel plugin for Leaflet, by Jacob Toye: this plugin is used to display the clusters at low zoom levels. The style used by the map is from an example in that plugin sources.
License: MIT
https://github.com/jacobtoye/Leaflet.iconlabel
I just saw that there now exists (since Sept 23) a Leaflet.Label plugin that should be better for what we are doing... - Markercluster plugin for leaflet, by Dave Leaver: by looking in their code, I discovered the Quick Hull algorithm. Thanks to him.
https://github.com/danzel/Leaflet.markercluster - JOSM: for the tag presets, modified to add the surveillance extended tags.
License: GNU GPL v3