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

Class: Services_OpenStreetMap

Source Location: /Services_OpenStreetMap-1.0.0RC2/Services/OpenStreetMap.php

Class Overview


Services_OpenStreetMap - interface with OpenStreetMap


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2010-2019 Ken Guest

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 33]
Services_OpenStreetMap - interface with OpenStreetMap


[ Top ]


Class Variables

$api =  null

[line 60]

API Object
  • Access: protected



[ Top ]

$config =  null

[line 42]

Default config settings
  • See: Services_OpenStreetMap::getConfig
  • See: Services_OpenStreetMap::setConfig
  • Access: protected



[ Top ]

$transport =  null

[line 67]

Transport
  • Access: protected



[ Top ]

$xml =  null

[line 51]

Retrieved XML
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 93]

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

Constructor; which optionally sets config details.
  • Access: public

Parameters:

array   $configuration   —  Defaults to empty array if none provided

[ Top ]

autoload   [line 76]

boolean autoload( string $class)

Autoloader
  • Access: public

Parameters:

string   $class   —  Name of class

[ Top ]

bboxToMinMax   [line 134]

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

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

That is, return a,b,c,d as b,a,d,c

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

  • Access: public

Parameters:

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

[ Top ]

get   [line 160]

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

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

Use in conjunction with bboxToMinMax if required.

  1.  // $osm->get($osm->bboxToMinMax($minLat, $minLon, $maxLat, $maxLon));
  2.  $osm = new Services_OpenStreetMap();
  3.  $osm->get(-8.356475852.821022799999994-7.733001753.0428644);
  4.  file_put_contents("area_covered.osm"$osm->getXML());

  • Throws: Services_OpenStreetMap_Exception
  • Throws: HTTP_Request2_Exception
  • 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 ]

getApiStatus   [line 537]

string getApiStatus( )

Status of the main OSM API (offline/readonly/online)
  • Access: public

[ Top ]

getConfig   [line 571]

Services_OpenStreetMap_Config getConfig( )

Get current Config object
  • Access: public

[ Top ]

getCoordsOfPlace   [line 190]

array getCoordsOfPlace( string $place)

Get co-ordinates of some named place

Place can be comma delimited for precision. e.g. 'Limerick, Ireland'

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

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

getDatabaseStatus   [line 527]

string getDatabaseStatus( )

Status of the OSM database (offline/readonly/online)
  • Access: public

[ Top ]

getGpxStatus   [line 547]

string getGpxStatus( )

Status of the OSM GPX API (offline/readonly/online)
  • Access: public

[ Top ]

getIDs   [line 263]

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).
  • Access: public

Parameters:

mixed   $args   —  results of call to func_get_args

[ Top ]

getMaxArea   [line 466]

float getMaxArea( )

Maximum Area

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

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

  • Access: public

[ Top ]

getMaxElements   [line 517]

float getMaxElements( )

Number of elements allowed per changeset

Maximum number of elements...

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

  • Access: public

[ Top ]

getMaxNodes   [line 500]

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

  • Access: public

[ Top ]

getMaxVersion   [line 449]

float getMaxVersion( )

Maximum Version

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

  • Access: public

[ Top ]

getMinVersion   [line 431]

float getMinVersion( )

Minimum Version

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

  • Access: public

[ Top ]

getPlace   [line 211]

mixed getPlace( string $place, [string $format = 'xml'], [bool $addressdetails = false])

Return a structured result set for $place
  • Access: public

Parameters:

string   $place   —  Location to search for details of
string   $format   —  Format to retrieve. json/xml (default)
bool   $addressdetails   —  Gathers more details of place if TRUE.

[ Top ]

getTimeout   [line 413]

int getTimeout( )

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

[ Top ]

getTracepointsPerPage   [line 483]

float getTracepointsPerPage( )

Maximum number of tracepoints per page.

Re gpx tracepoints.

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

  • Access: public

[ Top ]

getTransport   [line 581]

Services_OpenStreetMap_Transport getTransport( )

Get current Transport object.
  • Access: public

[ Top ]

getXml   [line 293]

string getXml( )

Return XML.
  • Access: public

[ Top ]

loadXml   [line 283]

void loadXml( string $file)

Load XML from [cache] file.
  • Access: public

Parameters:

string   $file   —  filename

[ Top ]

reverseGeocode   [line 239]

object|string reverseGeocode( string $lat, string $lon, [bool $addressdetails = true], [int $zoom = 18], [string $format = 'xml'])

ReverseGeocode

Peform a reverse search/geoencoding.

  • Access: public

Parameters:

string   $lat   —  Latitude
string   $lon   —  Longitude
bool   $addressdetails   —  Whether to include address details in results
int   $zoom   —  Zoom level to search at
string   $format   —  Format to retrieve. json/xml (default)

[ Top ]

search   [line 333]

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.   }

  • Access: public

Parameters:

array   $criteria   —  what to search for

[ Top ]

setConfig   [line 559]

Services_OpenStreetMap setConfig( Services_OpenStreetMap_Config $config)

Set Config object
  • Access: public

Parameters:

Services_OpenStreetMap_Config   $config   —  Config settings.

[ Top ]

setTransport   [line 593]

Services_OpenStreetMap setTransport( Services_OpenStreetMap_Transport $transport)

Set Transport object.
  • Access: public

Parameters:

Services_OpenStreetMap_Transport   $transport   —  transport object

[ Top ]

__call   [line 612]

mixed __call( string $name, array $arguments)

Execute method provided by API class.

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

  • 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 Tue, 28 May 2019 19:19:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.