src/Elements.php
public function createRelation($changeset, $tags, $members)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the API base
		$base = 'relation/create';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		$tagList = '';

		// Create XML node
		if (!empty($tags))
		{
			foreach ($tags as $key => $value)
			{
				$tagList .= '<tag k="' . $key . '" v="' . $value . '"/>';
			}
		}

		// Members
		$memberList = '';

		if (!empty($members))
		{
			foreach ($members as $member)
			{
				if ($member['type'] == 'node')
				{
					$memberList .= '<member type="' . $member['type'] . '" role="' . $member['role'] . '" ref="' . $member['ref'] . '"/>';
				}
				elseif ($member['type'] == 'way')
				{
					$memberList .= '<member type="' . $member['type'] . '" ref="' . $member['ref'] . '"/>';
				}
			}
		}

		$xml = '<?xml version="1.0" encoding="UTF-8"?>
				<osm version="0.6" generator="JoomlaOpenStreetMap">
				<relation relation="' . $changeset . '" >'
					. $tagList
					. $memberList .
				'</relation>
			</osm>';

		$header['Content-Type'] = 'text/xml';

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'PUT', $parameters, $xml, $header);

		return $response->body;
	}
public function createRelation($changeset, $tags, $members)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the API base
		$base = 'relation/create';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		$tagList = '';

		// Create XML node
		if (!empty($tags))
		{
			foreach ($tags as $key => $value)
			{
				$tagList .= '<tag k="' . $key . '" v="' . $value . '"/>';
			}
		}

		// Members
		$memberList = '';

		if (!empty($members))
		{
			foreach ($members as $member)
			{
				if ($member['type'] == 'node')
				{
					$memberList .= '<member type="' . $member['type'] . '" role="' . $member['role'] . '" ref="' . $member['ref'] . '"/>';
				}
				elseif ($member['type'] == 'way')
				{
					$memberList .= '<member type="' . $member['type'] . '" ref="' . $member['ref'] . '"/>';
				}
			}
		}

		$xml = '<?xml version="1.0" encoding="UTF-8"?>
				<osm version="0.6" generator="JoomlaOpenStreetMap">
				<relation relation="' . $changeset . '" >'
					. $tagList
					. $memberList .
				'</relation>
			</osm>';

		$header['Content-Type'] = 'text/xml';

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'PUT', $parameters, $xml, $header);

		return $response->body;
	}
Method to create a relation

@param   integer  $changeset  Changeset id
@param   array    $tags       Array of tags for a relation
@param   array    $members    Array of members for a relation
eg: $members = array(array("type"=>"node", "role"=>"stop", "ref"=>"123"), array("type"=>"way", "ref"=>"123"))

@return  array  The XML response

@since   1.0