Services_OpenStreetMap
[ class tree: Services_OpenStreetMap ] [ index: Services_OpenStreetMap ] [ all elements ]

Class: Services_OpenStreetMap

Source Location: /OpenStreetMap.php

Class Overview


Services_OpenStreetMap - interface with OpenStreetMap


Author(s):

Version:

  • Release: 0.0.1

Copyright:

  • 2010 Ken Guest

Variables

Methods



Class Details

[line 30]
Services_OpenStreetMap - interface with OpenStreetMap



Tags:

author:  Ken Guest <kguest@php.net>
version:  Release: 0.0.1
copyright:  2010 Ken Guest
link:  http://pear.php.net/package/Services_OpenStreetMap
license:  BSD


[ Top ]


Class Variables

$config =  null

[line 39]

Default config settings



Tags:

see:  Services_OpenStreetMap::getConfig
see:  Services_OpenStreetMap::setConfig
access:  protected



[ Top ]

$transport =  null

[line 48]



Tags:

access:  protected

Type:   mixed


[ Top ]

$xml =  null

[line 46]

[Retrieved] XML



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method autoload [line 57]

static boolean autoload( string $class)

autoloader



Tags:

access:  public


Parameters:

string   $class   Name of class

[ Top ]

static method getIDs [line 196]

static array getIDs( mixed $args)

Given the results of a call to func_get_args return an array of unique valid IDs specified in those results (either 1 per argument or each argument containing an array of IDs).



Tags:

access:  public


Parameters:

mixed   $args   results of call to func_get_args

[ Top ]

constructor __construct [line 74]

Services_OpenStreetMap __construct( [array $configuration = array()])

constructor; which optionally sets config details.



Tags:

access:  public


Parameters:

array   $configuration   Defaults to empty array if none provided

[ Top ]

method bboxToMinMax [line 111]

array bboxToMinMax( mixed $minLat, mixed $minLon, mixed $maxLat, mixed $maxLon)

Convert a 'bbox' ordered set of coordinates to ordering required for get method.

  1.  $osm new Services_OpenStreetMap();
  2.  $osm->get($osm->bboxToMinMax($minLat$minLon$maxLat$maxLon));
  3.  file_put_contents("area_covered.osm"$osm->getXML());




Tags:

access:  public


Parameters:

mixed   $minLat   min Latitude
mixed   $minLon   min Longitude
mixed   $maxLat   max Latitude
mixed   $maxLon   max Longitude

[ Top ]

method get [line 133]

void get( string $minLon, string $minLat, string $maxLon, string $maxLat)

Get XML describing area prescribed by the given co-ordinates.

  1.  $osm new Services_OpenStreetMap();
  2.  $osm->get(-8.356475852.821022799999994-7.733001753.0428644);
  3.  file_put_contents("area_covered.osm"$osm->getXML());




Tags:

access:  public


Parameters:

string   $minLon   min Longitude (leftmost point)
string   $minLat   min Latitude (bottom point)
string   $maxLon   max Longitude (rightmost point)
string   $maxLat   max Latitude (top point)

[ Top ]

method getConfig [line 453]

Services_OpenStreetMap_Config getConfig( )

Get current Config object



Tags:

access:  public


[ Top ]

method getCoordsOfPlace [line 157]

array getCoordsOfPlace( string $place)

Get co-ordinates of some named place

  1.  $coords $osm->getCoordsOfPlace('Limerick, Ireland');




Tags:

return:  Associated array of lat/lon values.
throws:  Services_OpenStreetMap_Exception If the place can not be found.
access:  public


Parameters:

string   $place   name

[ Top ]

method getMaxArea [line 383]

float getMaxArea( )

Max size of area that can be downloaded in one request.

  1.  $osm new Services_OpenStreetMap();
  2.  $area_allowed $osm->getMaxArea();




Tags:

access:  public


[ Top ]

method getMaxElements [line 430]

float getMaxElements( )

Number of elements allowed per changeset

  1.  $osm new Services_OpenStreetMap();
  2.  $max $osm->getMaxElements();




Tags:

access:  public


[ Top ]

method getMaxNodes [line 415]

float getMaxNodes( )

Maximum number of nodes per way.

Anymore than that and the way must be split.

  1.  $osm new Services_OpenStreetMap();
  2.  $max $osm->getMaxNodes();




Tags:

access:  public


[ Top ]

method getMaxVersion [line 368]

float getMaxVersion( )

maxVersion - max API version supported by connected server.

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




Tags:

access:  public


[ Top ]

method getMinVersion [line 352]

float getMinVersion( )

minVersion - min API version supported by connected server.

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




Tags:

access:  public


[ Top ]

method getPlace [line 178]

void getPlace( string $place)

Return a structured result set for $place



Tags:

access:  public


Parameters:

string   $place   Location to search for details of

[ Top ]

method getTimeout [line 336]

int getTimeout( )

Return the number of seconds that must elapse before a connection is considered to have timed-out.



Tags:

access:  public


[ Top ]

method getTracepointsPerPage [line 398]

float getTracepointsPerPage( )

Maximum number of tracepoints per page.

  1.  $osm new Services_OpenStreetMap();
  2.  $tracepoints $osm->getTracepointsPerPage();




Tags:

access:  public


[ Top ]

method getTransport [line 463]

Services_OpenStreetMap_Transport getTransport( )

Get current Transport object.



Tags:

access:  public


[ Top ]

method getXml [line 226]

string getXml( )

return XML.



Tags:

access:  public


[ Top ]

method loadXml [line 216]

void loadXml( string $file)

Load XML from [cache] file.



Tags:

access:  public


Parameters:

string   $file   filename

[ Top ]

method search [line 267]

array search( array $criteria)

search based on given criteria.

returns an array of objects such as Services_OpenStreetMap_Node etc.

  1.   $osm new Services_OpenStreetMap();
  2.  
  3.   $osm->loadXML("./osm.osm");
  4.   $results $osm->search(array("amenity" => "pharmacy"));
  5.   echo "List of Pharmacies\n";
  6.   echo "==================\n\n";
  7.  
  8.   foreach ($results as $result{
  9.       $name $result->getTag('name');
  10.       $addrStreet $result->getTag('addr:street');
  11.       $addrCity $result->getTag('addr:city');
  12.       $addrCountry $result->getTag('addr:country');
  13.       $addrHouseName $result->getTag('addr:housename');
  14.       $addrHouseNumber $result->getTag('addr:housenumber');
  15.       $openingHours $result->getTag('opening_hours');
  16.       $phone $result->getTag('phone');
  17.  
  18.       $line1 ($addrHouseNumber$addrHouseNumber $addrHouseName;
  19.       if ($line1 != null{
  20.           $line1 .= ', ';
  21.       }
  22.       echo  "$name\n{$line1}{$addrStreet}\n$phone\n$openingHours\n\n";
  23.   }




Tags:

access:  public


Parameters:

array   $criteria   what to search for

[ Top ]

method setConfig [line 442]

Services_OpenStreetMap_API_V06 setConfig( Services_OpenStreetMap_Config $config)

Set Config object



Tags:

access:  public


Parameters:

Services_OpenStreetMap_Config   $config   Config settings.

[ Top ]

method setTransport [line 475]

Services_OpenStreetMap setTransport( Services_OpenStreetMap_Transport $transport)

set Transport object.



Tags:

access:  public


Parameters:

Services_OpenStreetMap_Transport   $transport   transport object

[ Top ]

method __call [line 493]

void __call( string $name, array $arguments)

__call

If possible, call the appropriate method of the API instance.




Tags:

throws:  Services_OpenStreetMap_Exception If the method is not supported by the API instance.
access:  public


Parameters:

string   $name   Name of missing method to call.
array   $arguments   Arguments to be used when calling method.

[ Top ]


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