Services_OpenStreetMap

# Class: Services_OpenStreetMap_API_V06

Source Location: /OpenStreetMap/API/V06.php

### Class Overview

Services_OpenStreetMap_API_V06

#### Author(s):

- Ken Guest <kguest@php.net>

### Variables

- $config
- $elements
- $newId
- $transport

### Methods

- createChangeset
- createNode
- getChangeset
- getConfig
- getNode
- getNodes
- getRelation
- getRelations
- getTransport
- getUser
- getWay
- getWays
- searchChangesets
- setConfig
- setTransport

### Class Details

[line 25]
Services_OpenStreetMap_API_V06

#### Tags:

author: | Ken Guest <kguest@php.net>
link: | API_V06.php
license: | BSD

[ Top ]

### Class Variables

#### $config = null

[line 37]

#### Tags:

access: | protected

Type: | mixed

[ Top ]

#### $elements = array('changeset', 'node', 'relation', 'way')

[line 33]

Elements supported by the API (v0.6).

Used for validation purposes.

#### Tags:

access: | protected

Type: | array

[ Top ]

#### $newId = -1

[line 44]

Counter for assigning IDs to [newly] created objects.

#### Tags:

access: | protected

Type: | int

[ Top ]

#### $transport = null

[line 35]

#### Tags:

access: | protected

Type: | mixed

[ Top ]

### Class Methods

### method createChangeset [line 160]

`Services_OpenStreetMap_Changeset createChangeset( [boolean $atomic = true])`

Create a changeset, used to transmit changes (creation, updates, deletion) to the server. Username and password must be set.

1. $config = array('user' => 'fred@example.net', 'password' => 'wilma4eva');
2. $osm = new Services_OpenStreetMap($config);
3. $changeset = $osm->createChangeset();

#### Tags:

see: | Services_OpenStreetMap_API_V06::setConfig()
access: | public

#### Parameters:

boolean | $atomic | atomic changeset?

[ Top ]

### method createNode [line 207]

`Services_OpenStreetMap_Node createNode( float $latitude, float $longitude, [array $tags = array()])`

Create and return a Services_OpenStreetMap_Node

1. $node = $osm->createNode($lat, $lon, array('building' => 'yes'));

#### Tags:

access: | public

#### Parameters:

float | $latitude | Latitude of node
float | $longitude | Longitude of node
array | $tags | Array of key->value tag pairs.

[ Top ]

### method getChangeset [line 140]

`string getChangeset( string $id, [string $version = null])`

Get details of specified changeset

1. $changeset = $osm->getChangeset(123456);

#### Tags:

access: | public

#### Parameters:

string | $id | numeric ID of changeset
string | $version | optional

[ Top ]

### method getConfig [line 64]

`Services_OpenStreetMap_Config getConfig( )`

Get current Config object

#### Tags:

access: | public

[ Top ]

### method getNode [line 339]

`string getNode( string $nodeID, [mixed $version = null])`

Get details of specified node

1. $osm = new Services_OpenStreetMap();
2. var_dump($osm->getNode(52245107));

#### Tags:

access: | public

#### Parameters:

string | $nodeID | nodeID
mixed | $version | [optional] version of node

[ Top ]

### method getNodes [line 367]

`Services_OpenStreetMap_Nodes getNodes( )`

Return an array of specified nodes.

If none can be retrieved, for example if they all have been deleted, then the boolean false value is returned.

1. $osm = new Services_OpenStreetMap();
2. var_dump($osm->getNodes(52245107, 52245108));

Or

1. $osm = new Services_OpenStreetMap();
2. var_dump($osm->getNodes(array(52245107, 52245108)));

#### Tags:

access: | public

[ Top ]

### method getRelation [line 106]

`string getRelation( mixed $relationID, [mixed $version = null])`

Get details of specified relation, optionally specify which version of the relation to be retrieved.

     $r = $osm->getRelation(1234567);
     $r = $osm->getRelation(1234567, 2);

#### Tags:

access: | public

#### Parameters:

mixed | $relationID | ID of relation
mixed | $version | [optional] version of relation

[ Top ]

### method getRelations [line 120]

`array getRelations( )`

Return an array of specified relations

     $relations = $osm->getRelations($relationId, $relation2Id);

#### Tags:

access: | public

[ Top ]

### method getTransport [line 87]

`Services_OpenStreetMap_Transport. getTransport( )`

Retrieve the current Transport instance.

#### Tags:

access: | public

[ Top ]

### method getUser [line 239]

`Services_OpenStreetMap_User getUser( )`

Get a Services_OpenStreetMap_User object for the [current] user.

May return false if the user could not be found for any reason.

#### Tags:

see: | Services_OpenStreetMap_API_V06::setConfig()
throws: | Services_OpenStreetMap_Exception
access: | public

[ Top ]

### method getWay [line 299]

`string getWay( mixed $wayID, [mixed $version = null])`

Get details of specified way

#### Tags:

access: | public

#### Parameters:

mixed | $wayID | wayID
mixed | $version | [optional] version of way

[ Top ]

### method getWays [line 318]

`array getWays( )`

Return an array of specified ways.

     $ways = $osm->getWays($wayId, $way2Id);

#### Tags:

access: | public

[ Top ]

### method searchChangesets [line 176]

`Services_OpenStreetMap_Changesets searchChangesets( array $criteria)`

searchChangesets

#### Tags:

throws: | Services_OpenStreetMap_RuntimeException
access: | public

#### Parameters:

array | $criteria | Array of Services_OpenStreetMap_Criterion objects.

[ Top ]

### method setConfig [line 53]

`Services_OpenStreetMap_API_V06 setConfig( Services_OpenStreetMap_Config $config)`

Set Config object

#### Tags:

access: | public

#### Parameters:

Services_OpenStreetMap_Config | $config | Config object.

[ Top ]

### method setTransport [line 76]

`Services_OpenStreetMap_Config setTransport( Services_OpenStreetMap_Transport $transport)`

Set the Transport instance.

#### Tags:

access: | public

#### Parameters:

Services_OpenStreetMap_Transport | $transport | Transport instance.

[ Top ]

Documentation generated on Wed, 26 Sep 2012 01:24:54 +0100 by phpDocumentor 1.4.4