1
0
Fork
You've already forked sus
0
Surveillance Under Surveillance
  • PHP 64.2%
  • JavaScript 27%
  • Shell 8.4%
  • Hack 0.4%
Find a file
2025年10月07日 01:58:44 +02:00
init_cameras do not assume username and database name 2025年10月07日 00:54:19 +02:00
update_cameras m. remove closing tags from includes, to avoid potential whitespace outputs 2025年10月07日 01:58:44 +02:00
www m. remove closing tags from includes, to avoid potential whitespace outputs 2025年10月07日 01:58:44 +02:00
.gitignore Added news on the main page 2012年09月29日 22:26:03 +02:00
COPYING Initial commit 2012年09月26日 22:20:33 +02:00
README.md - Include the Leaflet.iconlabel files since there is now a license 2025年10月07日 01:48:15 +02:00

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:

Installation

  1. Set up a LAMP server on which the application will be installed

  2. Setting up the database structure

  • Create a database, e.g. called "camera"
  • Run init_cameras/db/createDb.sql within your database, e.g.: mariadb -h localhost -u root -p < createDb.sql
  • Create a user, e.g. camselect, and give it only SELECT permissions on the database, e.g.: GRANT SELECT ON camera.* TO camselect@localhost;
  1. Initializing the cameras in the database
  • rqt.sql contains 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:
  1. Set up automatic updating of the camera data
  • Enter the update_cameras directory
  • The automatic update is based on the sequenceNumber comparison between the current state.txt from the replicate server, and the locally stored lastState.txt. So if you downloaded a planet file, you should modify sequenceNumber in lastState.txt file accordingly.
  • Copy or rename config.php.example to config.php and set the values you wish
  • Create directory update_cameras/logs
  • Add the update script to your crontab. Execute crontab -e and 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