Package: osmcha
osmchaOSM Changeset Analyser,osmcha, is a Python package to detect suspicious OSM changesets.
It was designed to be used withosmcha-django,
but also can be used standalone or in other projects.You can report issues or request new features in the theosmcha-frontend repository.Installationpip install osmchaUsagePython LibraryYou can read areplication changeset filedirectly from the web:fromosmcha.changesetimportChangesetListc=ChangesetList('https://planet.openstreetmap.org/replication/changesets/002/236/374.osm.gz')or from your local filesystem.c=ChangesetList('tests/245.osm.gz')c.changesetswill return a list containing data of all the changesets listed in the file.You can filter the changesets passing aGeoJSONfile with a polygon with your
interest area toChangesetListas the second argument.Finally, to analyse an especific changeset, do:fromosmcha.changesetimportAnalysech=Analyse(changeset_id)ch.full_analysis()Customizing Detection RulesYou can customize the detection rules by defining your prefered values when
initializing theAnalyzeclass. See below the default values.ch=Analyse(changeset_id,create_threshold=200,modify_threshold=200,delete_threshold=30,percentage=0.7,top_threshold=1000,suspect_words=[...],illegal_sources=[...],excluded_words=[...])Command Line InterfaceThe command line interface can be used to verify an especific changeset directly
from the terminal.Usage:osmcha <changeset_id>Detection Rulesosmchaworks by analysing how many map features the changeset created, modified
or deleted, and by verifying the presence of some suspect words in thecomment,sourceandimagery_usedfields of the changeset. Furthermore, we also
consider if the software editor used allows to import data or to do mass edits.
We considerpowerfull editors: JOSM, Merkaartor, level0, QGIS and ArcGis.In theUsagesection, you can see how to customize some of these detection rules.Possible ImportWe tag a changeset as apossible importif the number of created elements is
greater than 70% of the sum of elements created, modified and deleted and if it
creates more than 1000 elements or 200 elements case it used one of thepowerfull editors.Mass ModificationWe consider a changeset as amass modificationif the number of modified elements
is greater than 70% of the sum of elements created, modified and deleted and if it
modifies more than 200 elements.Mass DeletionAll changesets that delete more than 1000 elements are considered amass deletion.
If the changeset deletes between 200 and 1000 elements and the number of deleted
elements is greater than 70% of the sum of elements created, modified and deleted
it’s also tagged as amass deletion.Suspect wordsThe suspect words are loaded from ayaml file.
You can customize the words by setting another default file with a environment
variable:export SUSPECT_WORDS=<path_to_the_file>or pass a list of words to theAnalyseclass, more information on the sectionCustomizing Detection Rules. We use a list of illegal sources to analyse thesourceandimagery_usedfields and another more general list to examine
the comment field. We have also a list of excluded words to avoid false positives.New mapperVerify if the user has less than 5 edits or less than 5 mapping days.User has multiple blocksChangesets created by users that has received more than one block will be
flagged.OSM Server ConfigurationIf you need to use OSMCha with another OSM server instance, you need to configure the OSM_SERVER_URL environment variable, without trailing slash. Example:export OSM_SERVER_URL='https://www.openhistoricalmap.org'TestsTo run the tests onosmcha:git clone https://github.com/willemarcel/osmcha.git
cd osmcha
pip install -e .[test]
py.test -vPublishing a new versionUpdate the version number inosmcha/__init__.pyand execute
the following commands:python setup.py bdist_wheel
twine upload dist/osmcha-{version}...ChangelogCheckCHANGELOGfor the version history.Related projectsosmcha-django- backend and APIosmcha-frontend- frontend of theOSMChaapplicationosm-compare- library that analyse OSM features to input it to OSMChaLicenseGPLv3