Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

harmful-osm-edits

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harmful-osm-edits - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

2

fixtures/changesets/46645764.json

@@ -1,1 +0,1 @@

[{"oldVersion":null,"newVersion":{"type":"Feature","properties":{"action":"create","changeType":"added","osm:id":"4721662995","osm:version":"1","osm:timestamp":"2017-03-07T09:20:17Z","osm:changeset":"46645764","osm:uid":"4539428","osm:user":"DaveCellist","osm:type":"node","addr:street":"Camilo Sanchez","amenity":"place_of_worship","name":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa","name:en":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa","name:es":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa"},"geometry":{"type":"Point","coordinates":[-78.3113327,-0.1301676]}}}]
[{"oldVersion":null,"newVersion":{"type":"Feature","properties":{"osm:user:firstedit":"2016-09-08T01:24:42.000Z","osm:changeset":"46645764","name:en":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa","addr:street":"Camilo Sanchez","name:es":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa","osm:user:num_changes":64,"iso:3166_2":"EC-P","osm:uid":"4539428","action":"create","osm:user":"DaveCellist","osm:timestamp":"2017-03-07T09:20:17Z","osm:user:mapping_days":21,"osm:type":"node","osm:id":"4721662995","changeType":"added","iso:3166_1":"EC","osm:version":"1","name:language":"es","name":"Iglesia Evangélica Apostólica del Nombre de Jesús - Checa","amenity":"place_of_worship","name:language_idm":"auto_1","osm:user:changesetcount":43},"geometry":{"type":"Point","coordinates":[-78.3113327,-0.1301676]}}}]

@@ -1,1 +0,1 @@

[{"oldVersion":{"type":"Feature","properties":{"action":"modify","changeType":"modifiedOld","osm:id":"266273687","osm:version":"1","osm:timestamp":"2014-03-15T05:52:01Z","osm:changeset":"21111440","osm:uid":"395715","osm:user":"oo-O-oo","osm:type":"way","building":"yes"},"geometry":{"type":"Polygon","coordinates":[[[69.694434,40.2274244],[69.6951702,40.2275188],[69.6951938,40.2274116],[69.6944576,40.2273172],[69.694434,40.2274244]]]}},"newVersion":{"type":"Feature","properties":{"action":"modify","changeType":"modifiedNew","osm:id":"266273687","osm:version":"2","osm:timestamp":"2017-03-07T09:20:23Z","osm:changeset":"46645765","osm:uid":"5441995","osm:user":"SashaKa777","osm:type":"way","addr:housenumber":"1","addr:street":"кӯчаи Орджиникидзе","building":"yes","building:levels":"4","name":"1"},"geometry":{"type":"Polygon","coordinates":[[[69.694434,40.2274244],[69.6951702,40.2275188],[69.6951938,40.2274116],[69.6944576,40.2273172],[69.694434,40.2274244]]]}}}]
[{"oldVersion":{"type":"Feature","properties":{"osm:type":"way","iso:3166_2":"TJ-SU","osm:id":"266273687","osm:user:firstedit":"2011-01-15T15:23:28.000Z","osm:changeset":"21111440","changeType":"modifiedOld","action":"modify","osm:uid":"395715","iso:3166_1":"TJ","osm:version":"1","osm:user:mapping_days":248,"osm:timestamp":"2014-03-15T05:52:01Z","osm:user":"oo-O-oo","osm:user:changesetcount":646,"osm:user:num_changes":234917,"building":"yes"},"geometry":{"type":"Polygon","coordinates":[[[69.694434,40.2274244],[69.6951702,40.2275188],[69.6951938,40.2274116],[69.6944576,40.2273172],[69.694434,40.2274244]]]}},"newVersion":{"type":"Feature","properties":{"osm:user:firstedit":"2017-03-07T08:00:50.000Z","osm:changeset":"46645765","addr:street":"кӯчаи Орджиникидзе","osm:user:num_changes":96,"iso:3166_2":"TJ-SU","addr:housenumber":"1","osm:uid":"5441995","action":"modify","osm:user":"SashaKa777","osm:timestamp":"2017-03-07T09:20:23Z","osm:user:mapping_days":4,"osm:type":"way","osm:id":"266273687","changeType":"modifiedNew","iso:3166_1":"TJ","building:levels":"4","osm:version":"2","name:language":"ru","name":"1","name:language_idm":"auto_4","osm:user:changesetcount":50,"building":"yes"},"geometry":{"type":"Polygon","coordinates":[[[69.694434,40.2274244],[69.6951702,40.2275188],[69.6951938,40.2274116],[69.6944576,40.2273172],[69.694434,40.2274244]]]}}}]

@@ -0,1 +1,2 @@

#!/usr/bin/env node
'use strict';

@@ -12,5 +13,6 @@

const parseJson = require('./scripts/parseJson');
const augmentFeature = require('@mapbox/dynamosm-augmenter').augmentFeature;
const BUCKET = 'mapbox';
const KEY = 'real-changesets/';
const KEY = 'real-changesets/production/';

@@ -57,3 +59,24 @@ function fetchChangesetJSON(changesetId) {

return queue.add(() => {
return fetchChangesetJSON(changeset);
return fetchChangesetJSON(changeset)
.then((changesetData) => {
let data = JSON.parse(changesetData);
const oldNewGeojson = parseJson(data);
const augmentPromises = oldNewGeojson.map((feature) => {
return queue.add(() => {
return augmentFeature(feature.newVersion)
.then((newVersion) => {
feature.newVersion = newVersion;
if (feature.oldVersion)
return augmentFeature(feature.oldVersion);
else
return feature.oldVersion;
})
.then((oldVersion) => {
feature.oldVersion = oldVersion;
return feature;
});
});
});
return Promise.all(augmentPromises);
});
});

@@ -65,6 +88,4 @@ });

changesetsData.forEach((changesetData) => {
let data = JSON.parse(changesetData);
const oldNewGeojson = parseJson(data);
const outputFile = argv.output || './fixtures/changesets/' + data.metadata.id + '.json';
fs.writeFileSync(outputFile, JSON.stringify(oldNewGeojson));
const outputFile = argv.output || './fixtures/changesets/' + changesetData[0].newVersion.properties['osm:changeset'] + '.json';
fs.writeFileSync(outputFile, JSON.stringify(changesetData));
});

@@ -71,0 +92,0 @@ })

{
"name": "harmful-osm-edits",
"version": "0.2.2",
"version": "0.3.0",
"description": "Repository of problematic feature edits on OpenStreetMap",

@@ -29,4 +29,5 @@ "main": "index.js",

"real-changesets-parser": "^1.2.3",
"request": "^2.81.0"
"request": "^2.81.0",
"dynamosm-augmenter": "mapbox/dynamosm-augmenter#dbc2c55dbd860fcbebdd4ed925188b549d84e41c"
}
}

@@ -1,2 +0,2 @@

# Problematic feature edits on OpenStreetMap
# Problematic feature and changeset edits on OpenStreetMap

@@ -12,7 +12,10 @@

# Generate an example fixture for Mapbox, Bangalore
./generate-fixture.js --type node --id 3352016856 --version 21
# Generate an example fixture for Mapbox, Bangalore (feature)
./generate-feature-fixture.js --type node --id 3352016856 --version 21
# Generate a new fixture passing required arguments
./generate-fixture.js --type featureType --id featureId --version featureVersion
# Generate a new fixture for a feature passing required arguments
./generate-feature-fixture.js --type featureType --id featureId --version featureVersion
# Generate a new fixture for a changeset passing the required arguments
./generate-changeset-fixture.js --changeset changesetId
```

@@ -22,2 +25,4 @@

## Format
### Feature
```

@@ -31,126 +36,23 @@ {

### Example
An ideal fixture with a great `description`, `newVersion` and `oldVersion`.
```json
{
"description": "This feature is problematic because ...",
"newVersion": {
"type": "Feature",
"id": "node!3352016856!21",
"properties": {
"addr:city": "Bangalore",
"addr:housenumber": "221, 2nd Floor",
"addr:landmark": "Above State Bank of India Women's Branch",
"addr:postcode": "560038",
"addr:street": "13th Cross, 2nd Main",
"brand:wikidata": "Q17068357",
"name": "Mapbox",
"name:hi": "मॅपबॉक्स",
"name:kn": "ಮ್ಯಾಪ್ ಬಾಕ್ಸ್",
"name:ml": "മാപ്പ്ബോക്സ്",
"name:ru": "Мапбокс",
"name:ta": "மேப்பாக்ஸ்",
"name:uk": "Мапбокс",
"office": "company",
"operator": "Mapbox Technologies India Private Limited",
"website": "http://www.mapbox.com",
"wikipedia": "en:Mapbox",
"osm:type": "node",
"osm:id": 3352016856,
"osm:version": 21,
"osm:changeset": 43344070,
"osm:timestamp": 1478070497000,
"osm:uid": 1306,
"osm:user": "PlaneMad"
},
"geometry": {
"type": "Point",
"coordinates": [
77.6368034,
12.9810816
]
}
},
"oldVersion": {
"type": "Feature",
"id": "node!3352016856!20",
"properties": {
"addr:city": "Bangalore",
"addr:housenumber": "221, 2nd Floor",
"addr:landmark": "Above State Bank of India Women's Branch",
"addr:postcode": "560038",
"addr:street": "13th Cross, 2nd Main",
"name": "Mapbox",
"name:hi": "मॅपबॉक्स",
"name:kn": "ಮ್ಯಾಪ್ ಬಾಕ್ಸ್",
"name:ml": "മാപ്പ്ബോക്സ്",
"name:ru": "Мапбокс",
"name:ta": "மேப்பாக்ஸ்",
"name:uk": "Мапбокс",
"office": "company",
"website": "http://www.mapbox.com",
"wikipedia": "en:Mapbox",
"osm:type": "node",
"osm:id": 3352016856,
"osm:version": 20,
"osm:changeset": 42368001,
"osm:timestamp": 1474620794000,
"osm:uid": 3460649,
"osm:user": "Amisha Singla"
},
"geometry": {
"type": "Point",
"coordinates": [
77.6368034,
12.9810816
]
}
}
}
### Changeset
```
[
{
"oldVersion": "old Version for feature 1 of the changeset",
"newVersion: "new Version for feature 1 of the changeset"
},
{
"oldVersion": "old Version for feature 2 of the changeset",
"newVersion: "new Version for feature 2 of the changeset"
}
.
.
.
]
```
### Example
An ideal feature fixture with a great `description`, `newVersion` and `oldVersion`: [node-3352016856-21.json](https://github.com/mapbox/harmful-osm-edits/blob/master/sampleFixtures/feature.json)
A fixture where feature is deleted in it's `newVersion`, thus has only `oldVersion`.
```json
{
"description": "This feature is problematic because ...",
"newVersion": {},
"oldVersion": {
"type": "Feature",
"id": "node!3352016856!21",
"properties": {
"addr:city": "Bangalore",
"addr:housenumber": "221, 2nd Floor",
"addr:landmark": "Above State Bank of India Women's Branch",
"addr:postcode": "560038",
"addr:street": "13th Cross, 2nd Main",
"brand:wikidata": "Q17068357",
"name": "Mapbox",
"name:hi": "मॅपबॉक्स",
"name:kn": "ಮ್ಯಾಪ್ ಬಾಕ್ಸ್",
"name:ml": "മാപ്പ്ബോക്സ്",
"name:ru": "Мапбокс",
"name:ta": "மேப்பாக்ஸ்",
"name:uk": "Мапбокс",
"office": "company",
"operator": "Mapbox Technologies India Private Limited",
"website": "http://www.mapbox.com",
"wikipedia": "en:Mapbox",
"osm:type": "node",
"osm:id": 3352016856,
"osm:version": 21,
"osm:changeset": 43344070,
"osm:timestamp": 1478070497000,
"osm:uid": 1306,
"osm:user": "PlaneMad"
},
"geometry": {
"type": "Point",
"coordinates": [
77.6368034,
12.9810816
]
}
}
}
```
Example fixture for changeset : [46645754.json](https://github.com/mapbox/harmful-osm-edits/blob/master/sampleFixtures/changeset.json)
[
{
"old": {
"oldVersion": {
"type": "Feature",

@@ -24,3 +24,3 @@ "properties": {

},
"new": {
"newVersion": {
"type": "Feature",

@@ -47,2 +47,2 @@ "properties": {

}
]
]
{
"description": "Highway with invalid tags",
"newVersion": {
"type": "Feature",
"properties": {
"highway": "residential",
"phone": "202-403-9512",
"addr:housenum": 13,
"website": "http://www.municipalite.chertsey.qc.ca/"
"description": "This feature is problematic because ...",
"newVersion": {
"type": "Feature",
"id": "node!3352016856!21",
"properties": {
"addr:city": "Bangalore",
"addr:housenumber": "221, 2nd Floor",
"addr:landmark": "Above State Bank of India Women's Branch",
"addr:postcode": "560038",
"addr:street": "13th Cross, 2nd Main",
"brand:wikidata": "Q17068357",
"name": "Mapbox",
"name:hi": "मॅपबॉक्स",
"name:kn": "ಮ್ಯಾಪ್ ಬಾಕ್ಸ್",
"name:ml": "മാപ്പ്ബോക്സ്",
"name:ru": "Мапбокс",
"name:ta": "மேப்பாக்ஸ்",
"name:uk": "Мапбокс",
"office": "company",
"operator": "Mapbox Technologies India Private Limited",
"website": "http://www.mapbox.com",
"wikipedia": "en:Mapbox",
"osm:type": "node",
"osm:id": 3352016856,
"osm:version": 21,
"osm:changeset": 43344070,
"osm:timestamp": 1478070497000,
"osm:uid": 1306,
"osm:user": "PlaneMad"
},
"geometry": {
"type": "Point",
"coordinates": [
77.6368034,
12.9810816
]
}
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-105.0018310546875,
21.84301680883439
],
[
-104.98397827148438,
21.883164152969165
],
[
-104.88441467285156,
21.917567172190736
],
[
-104.85763549804688,
21.92011521355736
]
]
"oldVersion": {
"type": "Feature",
"id": "node!3352016856!20",
"properties": {
"addr:city": "Bangalore",
"addr:housenumber": "221, 2nd Floor",
"addr:landmark": "Above State Bank of India Women's Branch",
"addr:postcode": "560038",
"addr:street": "13th Cross, 2nd Main",
"name": "Mapbox",
"name:hi": "मॅपबॉक्स",
"name:kn": "ಮ್ಯಾಪ್ ಬಾಕ್ಸ್",
"name:ml": "മാപ്പ്ബോക്സ്",
"name:ru": "Мапбокс",
"name:ta": "மேப்பாக்ஸ்",
"name:uk": "Мапбокс",
"office": "company",
"website": "http://www.mapbox.com",
"wikipedia": "en:Mapbox",
"osm:type": "node",
"osm:id": 3352016856,
"osm:version": 20,
"osm:changeset": 42368001,
"osm:timestamp": 1474620794000,
"osm:uid": 3460649,
"osm:user": "Amisha Singla"
},
"geometry": {
"type": "Point",
"coordinates": [
77.6368034,
12.9810816
]
}
}
},
"oldVersion": {
"type": "Feature",
"properties": {
"highway": "residential"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-105.0018310546875,
21.84301680883439
],
[
-104.98397827148438,
21.883164152969165
],
[
-104.88441467285156,
21.917567172190736
],
[
-104.85763549804688,
21.92011521355736
]
]
}
}
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc