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 31]
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 40]

Default config settings



Tags:

see:  Services_Openstreetmap::getConfig
see:  Services_Openstreetmap::setConfig
access:  protected



[ Top ]

$transport =  null

[line 49]



Tags:

access:  protected

Type:   mixed


[ Top ]

$xml =  null

[line 47]

[Retrieved] XML



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method autoload [line 58]

static boolean autoload( string $class)

autoloader



Tags:

access:  public


Parameters:

string   $class   Name of class

[ Top ]

static method getIDs [line 179]

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 76]

void __construct( [array $config = array()])

constructor; which optionally sets config details.



Tags:

access:  protected


Parameters:

array   $config   Defaults to empty array if none provided

[ Top ]

method bboxToMinMax [line 110]

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 132]

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());




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 439]

Services_Openstreetmap_Config getConfig( )

Get current Config object



Tags:

access:  public


[ Top ]

method getCoordsOfPlace [line 155]

array getCoordsOfPlace( string $place)

Get co-ordinates of some named place

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




Tags:

access:  public


Parameters:

string   $place   name

[ Top ]

method getMaxArea [line 369]

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 416]

float getMaxElements( )

Number of elements allowed per changeset

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




Tags:

access:  public


[ Top ]

method getMaxNodes [line 401]

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 354]

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 338]

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 getTimeout [line 322]

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 384]

float getTracepointsPerPage( )

Maximum number of tracepoints per page.

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




Tags:

access:  public


[ Top ]

method getTransport [line 455]

Services_Openstreetmap_Transport getTransport( )

Get current Transport object.

If one is not defined, create it.




Tags:

access:  public


[ Top ]

method getXML [line 211]

string getXML( )

return XML.



Tags:

access:  public


[ Top ]

method loadXML [line 200]

void loadXML( string $file)

Load XML from [cache] file.



Tags:

access:  public


Parameters:

string   $file   filename

[ Top ]

method search [line 253]

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.       $addr_street $result->getTag('addr:street');
  11.       $addr_city $result->getTag('addr:city');
  12.       $addr_country $result->getTag('addr:country');
  13.       $addr_housename $result->getTag('addr:housename');
  14.       $addr_housenumber $result->getTag('addr:housenumber');
  15.       $opening_hours $result->getTag('opening_hours');
  16.       $phone $result->getTag('phone');
  17.  
  18.       $line1 ($addr_housenumber$addr_housenumber $addr_housename;
  19.       if ($line1 != null{
  20.           $line1 .= ', ';
  21.       }
  22.       echo  "$name\n{$line1}{$addr_street}\n$phone\n$opening_hours\n\n";
  23.   }




Tags:

access:  public


Parameters:

array   $criteria   what to search for

[ Top ]

method setConfig [line 428]

Services_Openstreetmap_API_V06 setConfig( Services_Openstreetmap_Config $config)

Set Config object



Tags:

access:  public


Parameters:

Services_Openstreetmap_Config   $config   Config settings.

[ Top ]

method __call [line 476]

void __call( string $name, array $arguments)

__call

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




Tags:

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, 11 Jan 2012 00:37:09 +0000 by phpDocumentor 1.4.4