/** * Testa * * @return void */ public function testa() { $mock = new HTTP_Request2_Adapter_Mock(); $mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); $mock->addResponse(fopen(__DIR__ . '/responses/get_notes.xml', 'rb')); $server = 'http://api06.dev.openstreetmap.org/'; $config = array('adapter' => $mock, 'server' => $server); $osm = new Services_OpenStreetMap($config); $minlon = "-8.2456593"; $minlat = "52.8488977"; $maxlon = "-8.1751247"; $maxlat = "52.8839662"; $notes = $osm->getNotesByBbox($minlon, $minlat, $maxlon, $maxlat, 200, 14); $note = $notes[0]; $this->assertInstanceOf('Services_OpenStreetMap_Notes', $notes); $this->assertInstanceOf('Services_OpenStreetMap_Note', $note); $comments = $note->getComments(); $comment = $comments[0]; $this->assertInstanceOf('Services_OpenStreetMap_Comment', $comment); $this->assertInstanceOf('Services_OpenStreetMap_Comments', $comments); }
* @version Release: @package_version@ * @link example12_notes.php */ $version = '@package_version@'; if (strstr($version, 'package_version')) { set_include_path(dirname(dirname(__FILE__)) . ':' . get_include_path()); } require_once 'Services/OpenStreetMap.php'; $osm = new Services_OpenStreetMap(array('verbose' => true)); try { $osm->getConfig()->setServer('http://api.openstreetmap.org/'); } catch (Exception $ex) { var_dump($ex->getMessage()); // Fall back to default server...so carry on. } $notes = $osm->getNotesByBbox(-8.247245026639691, 52.8482419135407, -8.17416147865479, 52.8995782553221); echo $notes; foreach ($notes as $note) { echo 'ID: ', $note->getId(), "\n"; echo 'LAT/LON: ', $note->getLat(), "/", $note->getLon(), "\n"; echo 'STATUS: ', $note->getStatus(), "\n"; echo 'CREATED: ', strftime("%c %T", $note->getDateCreated()), "\n"; echo 'URL: ', $note->getUrl(), "\n"; echo 'COMMENT URL: ', $note->getCommentUrl(), "\n"; echo 'CLOSE URL: ', $note->getCloseUrl(), "\n"; echo "\n\nComments:\n"; $comments = $note->getComments(); foreach ($comments as $comment) { echo 'Action: ', $comment->getAction(), "\n"; echo 'Date: ', $comment->getDate(), "\n"; echo $comment->getText(), "\n";