-
-
Save manoharuss/1715a1d1a20b37d95733069346e28a01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rp = require('request-promise-native'); | |
const feature = { 'type':'Feature','id':'relation!6517677!3','properties':{ 'internet_access':'wlan','internet_access:fee':'no','name':'DoubleTree by Hilton St. Paul East','smoking':'no','tourism':'hotel','osm:type':'relation','osm:id':6517677,'osm:version':3,'osm:changeset':61091946,'osm:timestamp':1532618174000,'osm:uid':3769434,'osm:user':'manoharuss' },'geometry':{ 'type':'MultiPolygon','coordinates':[[[[-93.0056853,44.9494124],[-93.00572,44.9494125],[-93.0057205,44.9493367],[-93.0059132,44.9493373],[-93.0059135,44.9492833],[-93.0060122,44.9492836],[-93.0060123,44.9492746],[-93.0061143,44.9492749],[-93.0061143,44.9492634],[-93.0062995,44.949264],[-93.0062998,44.949214],[-93.0064018,44.9492143],[-93.006402,44.9491715],[-93.0065012,44.9491718],[-93.006501,44.9492125],[-93.0067615,44.9492133],[-93.0067597,44.9495062],[-93.0056848,44.9495029],[-93.0056853,44.9494124]]]] } }; | |
const featureChange = Object.assign({}, feature, { | |
properties: Object.assign({}, feature.properties, { | |
suspicions: [{ reason: 'Test', is_visible: true }] | |
}) | |
}); | |
function postToOsmcha(featureChange) { | |
const requestOptions = { | |
method: 'POST', | |
uri: 'https://osmcha.mapbox.com/api' + '/v1/features/create/', | |
headers: { | |
Authorization: 'Token ' + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
}, | |
json: featureChange | |
}; | |
return rp(requestOptions).promise().catch((err) => { | |
console.error('ERROR: Errored while posting', err) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment