Git Product home page Git Product logo

whodidit's Introduction

WHODIDIT: OpenStreetMap Changeset Analyzer

This tool downloads replication diffs from OSM Planet site, calculates statistics on changes and registers which 0.01-degree tiles were affected, and stores this in a MySQL database. A series of PHP scripts and a JS frontend are used to access that data.

You can check a working installation at http://zverik.openstreetmap.ru/whodidit/

Installation

Database

Make a directory outside www root (for example, /home/?/whodidit) and place parse_osc.pl there. Then create mysql database with utf8 collation and grant a user right to create and update tables there. After that, create database tables:

./parse_osc.pl -h <host> -d <database> -u <user> -p <password> -c -v

Add the script to crontab:

6 * * * * /home/?/whodidit/parse_osc.pl -h <host> -d <database> -u <user> -p <password> \
    -l http://planet.openstreetmap.org/replication/hour/ \
    -s /home/?/whodidit/state.txt -w /usr/local/bin/wget

Now each hour your database will be updated with fresh data. Note that the same osmChange file should not be processed twice: the database has no means of skipping already processed files.

If you do not want to wait several days to import backlog of changesets, you can download a weekly backup (and a relevant state.txt) from http://zverik.openstreetmap.ru/whodidit/backup/

Frontend

Make a directory inside www root, for example, /var/www/whodidit. Put all files from www directory in it. Then create another directory, /var/www/whodidit/scripts and put there all four PHP scripts from scripts.

Update the line <script>var scripts = 'http://localhost/wdi/scripts/';</script> in index.html with the absolute URL of the directory you've put PHP files in. Then edit db.inc.php script, updating $frontend_url variable with the absolute path to index.html.

Then write your database parameters into connect() function in db.inc.php, and you're set.

What do scripts do?

  • parse_osc.pl: This script downloads and parses replication diffs, storing changeset information in a MySQL database. It can create tables (with -c switch). Run it without parameters to see a list of all possible options.
  • db.inc.php: Global settings for PHP scripts, also two useful functions (which can be updated in later versions, so be careful not to lose your settings -- sorry).
  • tiles.php: Queries the database for tiles in an area. Returns JSON with either error message (large areas and areas that have more than 1000 tiles are rejected) or all tiles with changeset numbers and other information.
  • changeset.php: Returns a JSON with detailed information for requested changeset ids. When called with latest=1 parameter, returns the latest changeset.
  • rss.php: As the title suggests, it generated an RSS feed with the latest changesets in a bbox.
  • index.html: The HTML page is a front-end to WDI infrastructure. It makes use of all PHP scripts and allows user to check WDI tiles and acquire RSS links.
  • whodidit.js: The JavaScript behind the front-end.

Author

Everything here (except OpenLayers, of course) is written by Ilya Zverev, licensed WTFPL.

whodidit's People

Contributors

nrenner avatar osmtools avatar richlv avatar zverik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whodidit's Issues

Timestamp on RSS feed

Could you add a timestamp of the changeset on the rss feed text. It would be really useful when I have a big backlog of unreviewed changesets.

error

/>
Fatal error: Uncaught Error: Class 'mysqli' not found in /home/zverik/www/whodidit/scripts/db.inc.php:7
Stack trace:
#0 /home/zverik/www/whodidit/scripts/rss.php(10): connect()
#1 {main}
thrown in /home/zverik/www/whodidit/scripts/db.inc.php on line 7

Show more than 10 results

Hi Zverik, thank you very much for this really useful tool!

I noticed that the maximum number of changesets that are shown for a rectangle seems to be 10. When there are more, only the newest 10 results are in the pop-up.
Could you add some way to look at all the results? A scrollbar, or some kind of pagination (1 | 2 | ... | 5) would be great.

Make smallest boxes smaller?

Is it possible to make the smallest box size even smaller?
In dense cities, this would help to find a changeset more quickly. But I don't know what the computing cost of smaller minimum boxes is, maybe it would slow things down too much?

Daily change digest

Produce not an hourly changeset feed, but a digest: once a day an rss entry should be produces with all changesets for 24 hours, along with an achavi link for a bbox.

Sharding

Сделать две таблицы: тайлы за последние полгода хранить в основной, остальное — в запасной, специально для запросов «за всё время».

Индикатор потенциальных импортов

Небольшая идея для усовершенствования инструмента. Еще одним видом потенциально подозрительных правок являются те, что содержат только созданные объекты в большом количестве.
Потенциально, такая правка может оказаться импортом (хотя, конечно, рисование одних только домов или poi, а также весьма гипотетическое рисование какого-то места с новым Bing'ом тоже может так выглядеть).

См. пример: http://forum.openstreetmap.org/viewtopic.php?pid=296499#p296499

Понимаю, что критерий не абсолютный, однако он ни чуть не хуже уже использующихся.

Предлагаю добавить для областей с такими правками добавить дополнительный цвет индикатора - #00FFCC

Перевести на GEOMETRY

Всё-таки запрос по геометрии должен быть быстрее. Проверить это, и перевести на POINT().

source information

Can the source information of a changeset be included into the feed? Would sometime be quiet informative. Best regards Johannes!

Линии и отношения

На самом деле же можно отслеживать большинство линий: кэшировать последние N точек (смысл будет от 10 миллионов), обрабатывать линии и отношения в диффе после точек.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.