Source for file changesets.php
Documentation is available at changesets.php
* @package Joomla.Platform
* @subpackage Openstreetmap
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
defined('JPATH_PLATFORM') or die();
* Openstreetmap API Changesets class for the Joomla Platform
* @package Joomla.Platform
* @subpackage Openstreetmap
* Method to create a changeset
* @param array $changesets Array which contains changeset data
* @return array The XML response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key'],
'oauth_token_secret' =>
$token['secret']
$base =
'changeset/create';
// Build the request path.
$xml =
'<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="JOpenstreetmap">';
// Create Changeset element for every changeset
foreach ($changesets as $tags)
// Create a list of tags for each changeset
foreach ($tags as $key =>
$value)
$xml .=
'<tag k="' .
$key .
'" v="' .
$value .
'"/>';
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'PUT', $parameters, $xml, $header);
* Method to read a changeset
* @param integer $id identifier of the changeset
* @return array The XML response about a changeset
$base =
'changeset/' .
$id;
// Build the request path.
return $xml_string->changeset;
* Method to update a changeset
* @param integer $id Identifier of the changeset
* @param array $tags Array of tags to update
* @return array The XML response of updated changeset
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'changeset/' .
$id;
// Build the request path.
// Create a list of tags to update changeset
foreach ($tags as $key =>
$value)
$tag_list .=
'<tag k="' .
$key .
'" v="' .
$value .
'"/>';
$xml =
'<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="JOpenstreetmap">
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'PUT', $parameters, $xml, $header);
return $xml_string->changeset;
* Method to close a changeset
* @param integer $id identifier of the changeset
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'changeset/' .
$id .
'/close';
// Build the request path.
$header['format'] =
'text/xml';
$this->oauth->oauthRequest($path, 'PUT', $parameters, $header);
* Method to download a changeset
* @param integer $id Identifier of the changeset
* @return array The XML response of requested changeset
$base =
'changeset/' .
$id .
'/download';
// Build the request path.
return $xml_string->create;
* Method to expand the bounding box of a changeset
* @param integer $id Identifier of the changeset
* @param array $nodes List of lat lon about nodes
* @return array The XML response of changed changeset
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'changeset/' .
$id .
'/expand_bbox';
// Build the request path.
// Create a list of tags to update changeset
foreach ($nodes as $node)
$node_list .=
'<node lat="' .
$node[0] .
'" lon="' .
$node[1] .
'"/>';
$xml =
'<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="JOpenstreetmap">
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
return $xml_string->changeset;
* Method to query on changesets
* @param string $param Parameters for query
* @return array The XML response
$base =
'changesets/' .
$param;
// Build the request path.
* Method to upload a diff to a changeset
* @param string $xml Diff data to upload
* @param integer $id Identifier of the changeset
* @return array The XML response of result
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'changeset/' .
$id .
'/upload';
// Build the request path.
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
return $xml_string->diffResult;
Documentation generated on Tue, 19 Nov 2013 14:55:39 +0100 by phpDocumentor 1.4.3