Skip to content

Instantly share code, notes, and snippets.

@ajsb85
Last active June 12, 2020 14:29
Show Gist options
  • Save ajsb85/9b06ca61edd44a82c126cd7f1b81e301 to your computer and use it in GitHub Desktop.
Save ajsb85/9b06ca61edd44a82c126cd7f1b81e301 to your computer and use it in GitHub Desktop.
/*
* If you are going to connect to the live API server to run a quick
* test that adds new data, such as POIs, with test/imaginary values
* please be responsible and delete them afterwards.
*/
require_once 'Services/OpenStreetMap.php';
$config = array(
// A password file, is a colon delimited file.
// Eg. [email protected]:yabbadabbado
'passwordfile' => './credentials',
// The live API server is api.openstreetmap.org
'server' => 'https://api06.dev.openstreetmap.org/',
);
$osm = new Services_OpenStreetMap($config);
$changeset = $osm->createChangeset();
$changeset->begin("Added traffic signals Barceloneta.");
// The latitude and longitude values here are intentionally invalid, see
// note above.
$lat = 41.3874572;
$lon = 2.1962599;
$node = $osm->createNode($lat, $lon, array(
'highway' => 'traffic_signals'
);
$changeset->add($node);
$changeset->commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment