Skip to content
Browse files

update & test Nominatim class

  • Loading branch information...
1 parent 66ebb4f commit ba2d23127d2d1594b45c4499f0a2c8ab49fe730f @kenguest committed Apr 9, 2012
Showing with 691 additions and 5 deletions.
  1. +68 −5 Services/OpenStreetMap/Nominatim.php
  2. +2 −0 tests/AllTests.php
  3. +221 −0 tests/NominatimTest.php
  4. +387 −0 tests/responses/search.html
  5. +13 −0 tests/responses/search.json
View
73 Services/OpenStreetMap/Nominatim.php
@@ -39,7 +39,7 @@ class Services_OpenStreetMap_Nominatim
/**
* __construct
*
- * @param Services_OpenStreetMap_Transport $transport
+ * @param Services_OpenStreetMap_Transport $transport Transport instance.
*
* @return Services_OpenStreetMap_Nominatim
*/
@@ -48,7 +48,14 @@ public function __construct($transport)
$this->setTransport($transport);
}
- private function buildQuery($place)
+ /**
+ * Build query portion for request.
+ *
+ * @param string $place Name of location/place to search for
+ *
+ * @return string
+ */
+ private function _buildQuery($place)
{
$format = $this->format;
$limit = $this->limit;
@@ -90,7 +97,7 @@ public function search($place, $limit = null)
}
$format = $this->format;
- $query = $this->buildQuery($place);
+ $query = $this->_buildQuery($place);
$url = $this->server . 'search?' . $query;
$response = $this->getTransport()->getResponse($url);
@@ -101,13 +108,15 @@ public function search($place, $limit = null)
} elseif ( $format == 'json' ) {
$places = json_decode($response->getBody());
return $places;
+ } elseif ($format == 'html') {
+ return $response->getBody();
}
}
/**
* setFormat
*
- * @param string $format Set format for data to be received in (json, xml)
+ * @param string $format Set format for data to be received in (html, json, xml)
*
* @return Services_OpenStreetMap_Nominatim
* @throws Services_OpenStreetMap_RuntimeException If the specified format
@@ -116,6 +125,7 @@ public function search($place, $limit = null)
public function setFormat($format)
{
switch($format) {
+ case 'html':
case 'json':
case 'xml':
$this->format = $format;
@@ -129,6 +139,16 @@ public function setFormat($format)
}
/**
+ * get which format is set for this instance (xml, json, html)
+ *
+ * @return string
+ */
+ public function getFormat()
+ {
+ return $this->format;
+ }
+
+ /**
* setLimit
*
* @param integer $limit Maximum number of entries to retrieve
@@ -148,6 +168,16 @@ public function setLimit($limit)
}
/**
+ * get Limit
+ *
+ * @return integer
+ */
+ public function getLimit()
+ {
+ return $this->limit;
+ }
+
+ /**
* set Transport object.
*
* @param Services_OpenStreetMap_Transport $transport transport object
@@ -170,19 +200,52 @@ public function getTransport()
return $this->transport;
}
+ /**
+ * Set which server to connect to.
+ *
+ * Possible values are 'nominatim', 'mapquest' and any other valid
+ * endpoint specified as an URL.
+ *
+ * @param string $server Server URL or shorthand (nominatim / mapquest)
+ *
+ * @return Services_OpenStreetMap_Nominatim
+ */
public function setServer($server)
{
switch($server) {
case 'nominatim':
$this->server = 'http://nominatim.openstreetmap.org/';
+ return $this;
break;
case 'mapquest':
$this->server = 'http://open.mapquestapi.com/nominatim/v1/';
+ return $this;
break;
default:
- $this->server = $server;
+ $parsed = parse_url($server);
+ if (isset($parsed['scheme'])
+ && isset($parsed['host'])
+ && isset($parsed['path'])
+ ) {
+ $this->server = $server;
+ } else {
+ throw new Services_OpenStreetMap_RuntimeException(
+ 'Server endpoint invalid'
+ );
+ }
+ return $this;
}
}
+
+ /**
+ * Retrieve server endpoint.
+ *
+ * @return string
+ */
+ public function getServer()
+ {
+ return $this->server;
+ }
}
?>
View
2 tests/AllTests.php
@@ -25,6 +25,7 @@
require_once 'ChangesetTest.php';
require_once 'ConfigTest.php';
+require_once 'NominatimTest.php';
require_once 'NodeTest.php';
require_once 'OSMTest.php';
require_once 'RelationTest.php';
@@ -68,6 +69,7 @@ public static function suite()
$suite->addTestSuite('ConfigTest');
$suite->addTestSuite('OSMTest');
$suite->addTestSuite('NodeTest');
+ $suite->addTestSuite('NominatimTest');
$suite->addTestSuite('RelationTest');
$suite->addTestSuite('UserTest');
$suite->addTestSuite('WayTest');
View
221 tests/NominatimTest.php
@@ -0,0 +1,221 @@
+<?php
+/**
+ * Unit testing for Services_OpenStreetMap_Nominatim class.
+ *
+ * PHP Version 5
+ *
+ * @category Services
+ * @package Services_OpenStreetMap
+ * @subpackage UnitTesting
+ * @author Ken Guest <kguest@php.net>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version Release: @package_version@
+ * @link NominatimTest.php
+ */
+
+$version = '@package_version@';
+if (strstr($version, 'package_version')) {
+ set_include_path(dirname(dirname(__FILE__)) . ':' . get_include_path());
+}
+
+require_once 'Services/OpenStreetMap.php';
+
+require_once 'HTTP/Request2.php';
+require_once 'HTTP/Request2/Adapter/Mock.php';
+require_once 'PHPUnit/Framework/TestCase.php';
+
+
+/**
+ * Test Services_OpenStreetMap_Config functionality and how it's used
+ * throughout the Services_OpenStreetMap package.
+ *
+ * @category Services
+ * @package Services_OpenStreetMap
+ * @subpackage UnitTesting
+ * @author Ken Guest <kguest@php.net>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link ConfigTest.php
+ */
+class NominatimTest extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * test the getCoordsOfPlace method.
+ *
+ * @return void
+ */
+ public function testGetCoordsOfPlace()
+ {
+ $mock = new HTTP_Request2_Adapter_Mock();
+ $mock->addResponse(
+ fopen(__DIR__ . '/responses/nominatim_search_limerick.xml', 'rb')
+ );
+
+ $osm = new Services_OpenStreetMap(array('adapter' => $mock));
+ $this->AssertEquals(
+ $osm->getCoordsOfPlace('Limerick, Ireland'),
+ array('lat'=> '52.6612577', 'lon'=> '-8.6302084')
+ );
+ }
+
+ /**
+ * An exception should be thrown if the place of interest can not be
+ * found.
+ *
+ * @expectedException Services_OpenStreetMap_Exception
+ * @expectedExceptionMessage Could not get coords for Neeenaaa, Ireland
+ *
+ * @return void
+ */
+ public function testGetCoordsOfNonExistentPlace()
+ {
+ $mock = new HTTP_Request2_Adapter_Mock();
+ $mock->addResponse(
+ fopen(
+ __DIR__ . '/responses/nominatim_search_neeenaaa.xml',
+ 'rb'
+ )
+ );
+
+ $osm = new Services_OpenStreetMap(array('adapter' => $mock));
+ $osm->getCoordsOfPlace('Neeenaaa, Ireland');
+ }
+
+ public function testSetFormatHtml()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setFormat('html');
+ $this->assertEquals($nominatim->getFormat(), 'html');
+ }
+
+ public function testSetFormatJson()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setFormat('json');
+ $this->assertEquals($nominatim->getFormat(), 'json');
+ }
+
+ public function testSetFormatXml()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setFormat('xml');
+ $this->assertEquals($nominatim->getFormat(), 'xml');
+ }
+
+ /**
+ * Check that an exception is thrown when attempting to set format to an
+ * unrecognised value.
+ *
+ * @expectedException Services_OpenStreetMap_RuntimeException
+ * @expectedExceptionMessage Unrecognised format (xhtml)
+ *
+ * @return void
+ */
+ public function testInvalidFormat()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setFormat('xhtml');
+ }
+
+
+ public function testSetLimit()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setLimit(1);
+ $this->assertEquals($nominatim->getLimit(), 1);
+ }
+
+ /**
+ * Check that an exception is thrown when attempting to set limit to an
+ * unrecognised value.
+ *
+ * @expectedException Services_OpenStreetMap_RuntimeException
+ * @expectedExceptionMessage Limit must be a numeric value
+ *
+ * @return void
+ */
+ public function testSetInvalidLimit()
+ {
+ $osm = new Services_OpenStreetMap();
+ $transport = $osm->getTransport();
+ $nominatim = new Services_OpenStreetMap_Nominatim($transport);
+ $nominatim->setLimit('one');
+ }
+
+ public function testJsonSearch()
+ {
+ $mock = new HTTP_Request2_Adapter_Mock();
+ $mock->addResponse(fopen(__DIR__ . '/responses/search.json', 'rb'));
+
+ $osm = new Services_OpenStreetMap(array('adapter' => $mock));
+
+ $nominatim = new Services_OpenStreetMap_Nominatim($osm->getTransport());
+ $nominatim->setFormat('json');
+ $place = $nominatim->search('Limerick, Ireland', 1);
+ $this->assertEquals($place[0]->class, 'place');
+ $this->assertEquals($place[0]->type, 'city');
+ $this->assertEquals($place[0]->osm_type, 'node');
+ }
+
+ public function testHtmlSearch()
+ {
+ $mock = new HTTP_Request2_Adapter_Mock();
+ $mock->addResponse(fopen(__DIR__ . '/responses/search.html', 'rb'));
+
+ $osm = new Services_OpenStreetMap(array('adapter' => $mock));
+ $nominatim = new Services_OpenStreetMap_Nominatim($osm->getTransport());
+ $nominatim->setFormat('html');
+ $place = $nominatim->search('Limerick, Ireland', 1);
+ $this->assertNotNull($place);
+ }
+
+ public function testSetServer()
+ {
+ $osm = new Services_OpenStreetMap();
+ $nominatim = new Services_OpenStreetMap_Nominatim($osm->getTransport());
+
+ $this->assertEquals(
+ $nominatim->getServer(),
+ 'http://nominatim.openstreetmap.org/'
+ );
+ $this->assertEquals(
+ $nominatim->setServer('mapquest')->getServer(),
+ 'http://open.mapquestapi.com/nominatim/v1/'
+ );
+ $this->assertEquals(
+ $nominatim->setServer('nominatim')->getServer(),
+ 'http://nominatim.openstreetmap.org/'
+ );
+ $this->assertEquals(
+ $nominatim->setServer('http://nominatim.example.com/')->getServer(),
+ 'http://nominatim.example.com/'
+ );
+ }
+
+ /**
+ * Check that an exception is thrown when attempting to set limit to an
+ * unrecognised value.
+ *
+ * @expectedException Services_OpenStreetMap_RuntimeException
+ * @expectedExceptionMessage Server endpoint invalid
+ *
+ * @return void
+ */
+ public function testSetInvalidServerURL()
+ {
+ $osm = new Services_OpenStreetMap();
+ $nominatim = new Services_OpenStreetMap_Nominatim($osm->getTransport());
+ $nominatim->setServer('invalid');
+ }
+}
+?>
View
387 tests/responses/search.html
@@ -0,0 +1,387 @@
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=UTF-8
+
+<html>
+<head>
+ <title>OpenStreetMap Nominatim: Search</title>
+
+ <base href="http://nominatim.openstreetmap.org/" />
+ <link href="nominatim.xml" rel="search" title="Nominatim Search" type="application/opensearchdescription+xml" />
+
+ <script src="js/OpenLayers.js"></script>
+ <script src="js/tiles.js"></script>
+ <script src="js/prototype-1.6.0.3.js"></script>
+
+ <style>
+* {-moz-box-sizing: border-box;}
+body {
+ margin:0px;
+ padding:0px;
+ overflow: hidden;
+ background:#ffffff;
+ height: 100%;
+ font: normal 12px/15px arial,sans-serif;
+}
+#seachheader {
+ position:absolute;
+ z-index:5;
+ top:0px;
+ left:0px;
+ width:100%;
+ height:38px;
+ background:#F0F7FF;
+ border-bottom: 2px solid #75ADFF;
+}
+#q {
+ width:300px;
+}
+#seachheaderfade1, #seachheaderfade2, #seachheaderfade3, #seachheaderfade4{
+ position:absolute;
+ z-index:4;
+ top:0px;
+ left:0px;
+ width:100%;
+ opacity: 0.15;
+ filter: alpha(opacity = 15);
+ background:#000000;
+ border: 1px solid #000000;
+}
+#seachheaderfade1{
+ height:39px;
+}
+#seachheaderfade2{
+ height:40px;
+}
+#seachheaderfade3{
+ height:41px;
+}
+#seachheaderfade4{
+ height:42px;
+}
+#searchresultsfade1, #searchresultsfade2, #searchresultsfade3, #searchresultsfade4 {
+ position:absolute;
+ z-index:2;
+ top:0px;
+ left:200px;
+ height: 100%;
+ opacity: 0.2;
+ filter: alpha(opacity = 20);
+ background:#ffffff;
+ border: 1px solid #ffffff;
+}
+#searchresultsfade1{
+ width:1px;
+}
+#searchresultsfade2{
+ width:2px;
+}
+#searchresultsfade3{
+ width:3px;
+}
+#searchresultsfade4{
+ width:4px;
+}
+
+#searchresults{
+ position:absolute;
+ z-index:3;
+ top:41px;
+ width:200px;
+ height: 100%;
+ background:#ffffff;
+ border: 1px solid #ffffff;
+ overflow: auto;
+}
+#map{
+ position:absolute;
+ z-index:1;
+ top:38px;
+ left:200px;
+ width:100%;
+ height:100%;
+ background:#eee;
+}
+#report{
+ position:absolute;
+ z-index:2;
+ top:38px;
+ left:200px;
+ width:100%;
+ height:100%;
+ background:#eee;
+ font: normal 12px/15px arial,sans-serif;
+ padding:20px;
+}
+#report table {
+ margin-left:20px;
+}
+#report th {
+ vertical-align:top;
+ text-align:left;
+}
+#report td.button {
+ text-align:right;
+}
+.result {
+ margin:5px;
+ margin-bottom:0px;
+ padding:2px;
+ padding-left:4px;
+ padding-right:4px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ background:#F0F7FF;
+ border: 2px solid #D7E7FF;
+ font: normal 12px/15px arial,sans-serif;
+ cursor:pointer;
+}
+.result img{
+ float:right;
+}
+.result .latlon{
+ display: none;
+}
+.result .place_id{
+ display: none;
+}
+.result .type{
+ color: #999;
+ text-align:center;
+ font: normal 9px/10px arial,sans-serif;
+ padding-top:4px;
+}
+.result .details, .result .details a{
+ color: #999;
+ text-align:center;
+ font: normal 9px/10px arial,sans-serif;
+ padding-top:4px;
+}
+.noresults{
+ color: #000;
+ text-align:center;
+ font: normal 12px arial,sans-serif;
+ padding-top:4px;
+}
+.more{
+ color: #ccc;
+ text-align:center;
+ padding-top:4px;
+}
+.disclaimer{
+ color: #ccc;
+ text-align:center;
+ font: normal 9px/10px arial,sans-serif;
+ padding-top:4px;
+}
+form{
+ margin:0px;
+ padding:0px;
+}
+ </style>
+
+ <script type="text/javascript">
+
+ var map;
+
+ function handleResize()
+ {
+ if ($('searchresults'))
+ {
+ $('map').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200;
+ $('report').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200;
+ }
+ else
+ {
+ $('map').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 0;
+ $('map').style.left = 0;
+ }
+
+ if ($('map')) $('map').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
+ if ($('searchresults')) $('searchresults').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
+ if ($('report')) $('report').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
+ }
+ window.onresize = handleResize;
+
+ function panToLatLon(lat,lon) {
+ var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
+ map.panTo(lonLat, 2);
+ }
+
+ function panToLatLonZoom(lat,lon, zoom) {
+ var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
+ if (zoom != map.getZoom())
+ map.setCenter(lonLat, zoom);
+ else
+ map.panTo(lonLat, 10);
+ }
+
+ function panToLatLonBoundingBox(lat,lon,minlat,maxlat,minlon,maxlon,points) {
+ var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
+ var proj_map = map.getProjectionObject();
+ map.zoomToExtent(new OpenLayers.Bounds(minlon,minlat,maxlon,maxlat).transform(proj_EPSG4326, proj_map));
+
+ var pointList = [];
+ var style = {
+ strokeColor: "#75ADFF",
+ fillColor: "#F0F7FF",
+ strokeWidth: 2,
+ strokeOpacity: 0.75,
+ fillOpacity: 0.75
+ };
+ var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
+ var proj_map = map.getProjectionObject();
+ if (points)
+ {
+ points.each(function(p){
+ pointList.push(new OpenLayers.Geometry.Point(p[0],p[1]));
+ });
+ var linearRing = new OpenLayers.Geometry.LinearRing(pointList).transform(proj_EPSG4326, proj_map);;
+ var polygonFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null,style);
+ vectorLayer.destroyFeatures();
+ vectorLayer.addFeatures([polygonFeature]);
+ }
+ else
+ {
+ var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
+ var point = new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat);
+ var pointFeature = new OpenLayers.Feature.Vector(point,null,style);
+ vectorLayer.destroyFeatures();
+ vectorLayer.addFeatures([pointFeature]);
+ }
+ }
+
+ function round(v,n)
+ {
+ n = Math.pow(10,n);
+ return Math.round(v*n)/n;
+ }
+ function floor(v,n)
+ {
+ n = Math.pow(10,n);
+ return Math.floor(v*n)/n;
+ }
+ function ceil(v,n)
+ {
+ n = Math.pow(10,n);
+ return Math.ceil(v*n)/n;
+ }
+
+ function mapEventMove() {
+ var proj = new OpenLayers.Projection("EPSG:4326");
+ var bounds = map.getExtent();
+ bounds = bounds.transform(map.getProjectionObject(), proj);
+ $('viewbox').value = floor(bounds.left,2)+','+ceil(bounds.top,2)+','+ceil(bounds.right,2)+','+floor(bounds.bottom,2);
+ }
+
+ function init() {
+ handleResize();
+ map = new OpenLayers.Map ("map", {
+ controls:[
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PanZoomBar(),
+ new OpenLayers.Control.MouseDefaults(),
+ new OpenLayers.Control.MousePosition(),
+ new OpenLayers.Control.Attribution()],
+ maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
+ maxResolution: 156543.0399,
+ numZoomLevels: 19,
+ units: 'm',
+ projection: new OpenLayers.Projection("EPSG:900913"),
+ displayProjection: new OpenLayers.Projection("EPSG:4326"),
+ eventListeners: {
+ "moveend": mapEventMove
+ }
+ } );
+ map.addLayer(new OpenLayers.Layer.OSM.Mapnik("Default"));
+
+ var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
+ layer_style.fillOpacity = 0.2;
+ layer_style.graphicOpacity = 1;
+ vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
+ map.addLayer(vectorLayer);
+
+// var lonLat = new OpenLayers.LonLat(-8.6302084, 52.6612577).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
+// map.setCenter (lonLat, 2);
+ }
+
+ function setfocus(field_id) {
+ $(field_id).focus()
+ }
+
+ </script>
+</head>
+
+<body onload="setfocus('q');">
+
+ <div id="seachheaderfade1"></div><div id="seachheaderfade2"></div><div id="seachheaderfade3"></div><div id="seachheaderfade4"></div>
+
+ <div id="seachheader">
+ <form accept-charset="UTF-8" action="http://nominatim.openstreetmap.org/search.php" method="get">
+ <table border="0" width="100%">
+ <tr>
+ <td valign="center" style="width:30px;"><img src="images/logo.gif"></td>
+ <td valign="center" style="width:400px;"><input id="q" name="q" value="Limerick, Ireland" style="width:270px;"><input type="text" id="viewbox" style="width:130px;" name="viewbox"></td>
+ <td style="width:80px;"><input type="submit" value="Search"></td>
+ <td style="width:100px;"><input type="checkbox" value="1" name="polygon" > Highlight</td>
+<td style="text-align:right;">Data: 2012/04/08</td>
+<td style="text-align:right;">
+<a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a> | <a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ"
+target="_blank">FAQ</a></td>
+
+ <td style="text-align:right;"><input type="button" value="Report Problem With Results" onclick="$('report').style.visibility=($('report').style.visibility=='hidden'?'visible':'hidden')"></td>
+ </tr>
+ </table>
+ </form>
+ </div>
+
+ <div id="searchresultsfade1"></div><div id="searchresultsfade2"></div><div id="searchresultsfade3"></div><div id="searchresultsfade4"></div>
+ <div id="searchresults">
+<div class="result" onClick='panToLatLonBoundingBox(52.6612577, -8.6302084, 52.651254882813, 52.67125869751, -8.6402089691162, -8.6202080154419, "");'><img src="http://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png"> <span class="name">Limerick, County Limerick, Munster, Ireland, Europe</span> <span class="latlon">52.661,52.661</span> <span class="place_id">4353410</span> <span class="type">(City)</span> <span class="details">(<a href="details.php?place_id=4353410">details</a>)</span></div><div class="more"><a href="http://nominatim.openstreetmap.org/search?format=html&exclude_place_ids=4353410&accept-language=&q=Limerick%2C+Ireland">Search for more results</a></div> <div class="disclaimer">Addresses and postcodes are approximate
+ <input type="button" value="Report Problem" onclick="$('report').style.visibility=($('report').style.visibility=='hidden'?'visible':'hidden')">
+ </div>
+ </div>
+
+ <div id="map"></div>
+ <div id="report" style="visibility:hidden;"><div style="width:600px;margin:auto;margin-top:60px;">
+ <h2>Report a problem</h2>
+ <p>Before reporting problems please read the <a href="http://wiki.openstreetmap.org/wiki/Nominatim">user documentation</a> and <a
+href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ">FAQ</a>. If your problem relates to the address of a particular search result please use the 'details' link
+to check how the address was generated before reporting a problem.</p>
+ <p>Please use <a href="http://trac.openstreetmap.org/newticket?component=nominatim">trac.openstreetmap.org</a> to report problems
+making sure to set
+the component to 'nominatim'. You can search for existing bug reports <a href="http://trac.openstreetmap.org/query?status=new&status=assigned&status=reopened&component=nominatim&order=priority">here</a>.</p>
+ <p>Please ensure that you include a full description of the problem, including the search query that you used, the problem with the result and, if
+the problem relates to missing data, the osm id of the item that is missing. Problems that contain enough detail are likely to get looked at before ones that
+require significant research!</p>
+ </div>
+
+<!--
+ <p>Please use this form to report problems with the search results. Of particular interest are items missing, but please also use this form to
+report any other problems.</p>
+ <p>If your problem relates to the address of a particular search result please use the 'details' link to check how the address was generated before
+reporting a problem.</p>
+ <p>If you are reporting a missing result please (if possible) include the OSM ID of the item you where expecting (i.e. node 422162)</p>
+ <form method="post">
+ <table>
+ <tr><th>Your Query:</th><td><input type="hidden" name="report:query" value="Limerick, Ireland" style="width:500px;">Limerick, Ireland</td></tr>
+ <tr><th>Your Email Address(opt):</th><td><input type="text" name="report:email" value="" style="width:500px;"></td></tr>
+ <tr><th>Description of Problem:</th><td><textarea name="report:description" style="width:500px;height:200px;"></textarea></td></tr>
+ <tr><td colspan="2" class="button"><input type="button" value="Cancel" onclick="$('report').style.visibility='hidden'"><input type="submit" value="Report"></td></tr>
+ </table>
+ </form>
+ <h2>Known Problems</h2>
+ <ul>
+ <li>Countries where missed out of the index</li>
+ <li>Area Polygons relate to the search area - not the address area which would make more sense</li>
+ </ul>
+-->
+ </div>
+
+ <script type="text/javascript">
+init();
+panToLatLonBoundingBox(52.6612577, -8.6302084, 52.651254882813, 52.67125869751, -8.6402089691162, -8.6202080154419, "");
+</script>
+</body>
+
+</html>
View
13 tests/responses/search.json
@@ -0,0 +1,13 @@
+HTTP/1.1 200 OK
+Date: Mon, 09 Apr 2012 18:38:13 GMT
+Server: Apache/2.2.14 (Ubuntu)
+Content-Location: search.php
+Vary: negotiate
+TCN: choice
+X-Powered-By: PHP/5.3.2-1ubuntu4.14
+Access-Control-Allow-Origin: *
+Content-Length: 464
+Connection: close
+Content-Type: application/json; charset=UTF-8
+
+[{"place_id":"4353410","licence":"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.","osm_type":"node","osm_id":"428339453","boundingbox":["52.651254882813","52.67125869751","-8.6402089691162","-8.6202080154419"],"lat":"52.6612577","lon":"-8.6302084","display_name":"Limerick, County Limerick, Munster, Ireland, Europe","class":"place","type":"city","icon":"http://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png"}]

0 comments on commit ba2d231

Please sign in to comment.
Something went wrong with that request. Please try again.