This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
/
api.php
155 lines (145 loc) · 7.96 KB
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php include('header.php'); ?>
<title>OpenPOI Registry Web Services API</title>
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=473919912642476";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="banner">
<span id="title"></span>
<span id="sub">the web of location data</span>
</div>
<div class="ink-container">
<h1>Web Services API</h1>
<p>OpenPOIs has two APIs available for use. It implements the industry standard <a href="#wfsapi">Web Feature Service API</a> for geographic data query, and also has its <a href="#customapi">own custom API</a>.</p>
<h2><a name="customapi"></a>Custom API</h2>
<h3>Request base URL</h3>
<span class="codehl">http://openpois.net/poiquery.php?</span>
<h3>Parameters</h3>
<table class="ink-table ink-zebra ink-hover" width="80%">
<tbody>
<tr>
<th width="96" scope="col">parameter</th>
<th width="96" scope="col">type</th>
<th scope="col">description</th>
</tr>
<tr>
<td>id</td>
<td><em>UUID</em></td>
<td>globally unique id of the POI<br />
<em>if present, all other parameters (except format) are ignored</em></td>
</tr>
<tr>
<td>format</td>
<td><em>string<br />
</em></td>
<td>MIME type of the return value<br />
<strong>options:</strong> text/html, application/json or
application/xml <br />
<strong>default:</strong> text/html
</td>
</tr>
<tr>
<td>name</td>
<td><em>string</em></td>
<td>primary name/label of the POI<br />
<em>required if id is not present</em></td>
</tr>
<tr>
<td>bbox</td>
<td><em>comma-separated decimals</em></td>
<td>geographic bounding box in EPSG:4326 (lat/lon)<br />
<strong>format:</strong> left,lower,right,upper<br />
<em>if present, lat/lon/radius are ignored</em></td>
</tr>
<tr>
<td>lat</td>
<td><em>decimal</em></td>
<td>latitude<br />
<em>required for lat/lon/radius search</em></td>
</tr>
<tr>
<td>lon</td>
<td><em>decimal</em></td>
<td>longitude<br />
<em>required for lat/lon/radius search</em></td>
</tr>
<tr>
<td>radius</td>
<td><em>decimal</em></td>
<td>search distance from lat/lon in meters<br />
<em>used only for lat/lon/radius search<br />
</em><strong>default:</strong> 50
</td>
</tr>
<tr>
<td>start</td>
<td><em>date</em></td>
<td>POI came into existence after this date (POIs with no start date
are included)<br />
<strong>ex:</strong> 2011-10-01</td>
</tr>
<tr>
<td>end</td>
<td><em>date</em></td>
<td>POI ended existence before this date (POIs with no end date are
included)<br />
<strong>ex:</strong> 2012-05-01</td>
</tr>
<tr>
<td>maxfeatures</td>
<td><em>integer</em></td>
<td>maximum number of POIs to return<br />
<strong>default:</strong> 25 (maximum allowed is 25 also)</td>
</tr>
</tbody>
</table>
<h3>Query Examples</h3>
<h4>ID</h4>
<p class="codehl"><a href="http://openpois.net/poiquery.php?id=a75da8b9-5e85-46f2-9546-35c87ef0dda3&format=application/json"
target="_new">http://openpois.net/poiquery.php?id=a75da8b9-5e85-46f2-9546-35c87ef0dda3&format=application/json
</a></p>
<h4>RESTful ID</h4>
<p class="codehl"><a href="http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3"
target="_new">http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3</a></p>
<p class="codehl"><a href="http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3.json"
target="_new">http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3.json</a></p>
<p class="codehl"><a href="http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3.xml"
target="_new">http://openpois.net/pois/a75da8b9-5e85-46f2-9546-35c87ef0dda3.xml</a></p>
<h4>Radius and point</h4>
<p class="codehl"><a href="http://openpois.net/poiquery.php?lat=42.349433712876&lon=-71.040894451933&maxfeatures=9&format=application/xml"
target="_new">http://openpois.net/poiquery.php?lat=42.349433712876&lon=-71.040894451933&maxfeatures=9&format=application/xml</a></p>
<h4>Bounding box</h4>
<p><span class="codehl"><a href="http://openpois.net/poiquery.php?bbox=-71.10,42.35,-71.00,42.45&maxfeatures=20&format=application/json"
target="_new">http://openpois.net/poiquery.php?bbox=-71.10,42.35,-71.00,42.45&maxfeatures=20&format=application/json</a></span></p>
<h4>Time and area</h4>
<p class="codehl"><a href="http://openpois.net/poiquery.php?lat=25.959&lon=119.519&maxfeatures=1&format=xml&radius=1000&start=944"
target="_new">http://openpois.net/poiquery.php?lat=25.959&lon=119.519&maxfeatures=1&format=xml&radius=1000&start=944</a></p>
<p><br />
</p>
<h2><a name="wfsapi"></a>OGC Web Feature Service (WFS) API</h2>
<p>OpenPOIs implements the <a href="http://www.opengeospatial.org/standards/wfs">the OGC WFS standard</a> using <a href="http://mapserver.org/ogc/wfs_server.html">Mapserver's implementation</a>. WFS is a full-featured API with many more options than are shown here, but here are some examples on how to use it. For more information, see the <a href="http://www.opengeospatial.org/standards/wfs">spec</a> or <a href="http://mapserver.org/ogc/wfs_server.html">Mapserver's documentation</a>.</p>
<p><b>NOTE: </b><em>Due to the complex nature of the POI schema, the WFS API only recognizes a few fields of a POI -- the POI's ID, primary label and geographic coordinates. Until more work is done to expand the capabilities of the WFS API, use the custom API above to get all the POI data, or use the WFS API, and then take the POI ID contained in WFS responses to query against the custom API when you need full POI data.</em><p>
<h4>GetCapabilities</h4>
<p><span class="codehl"><a href="/openpoiwfs?request=GetCapabilities&service=WFS&version=1.1.0">http://openpois.net/openpoiwfs?request=GetCapabilities&service=WFS&version=1.1.0</a></p>
<h4>DescribeFeatureType (see the GML schema)</h4>
<p><span class="codehl"><a href="/openpoiwfs?request=DescribeFeatureType&service=WFS&version=1.1.0&typename=minipoi">http://openpois.net/openpoiwfs?request=DescribeFeatureType&service=WFS&version=1.1.0&typename=minipoi</a></p>
<h4>Get a single POI by ID</h4>
<p><span class="codehl"><a href="/openpoiwfs?request=GetFeature&service=WFS&version=1.1.0&typename=minipoi&featureid=minipoi.a75da8b9-5e85-46f2-9546-35c87ef0dda3">http://openpois.net/openpois.net/openpoiwfs?request=GetFeature&service=WFS&version=1.1.0&typename=minipoi&featureid=minipoi.a75da8b9-5e85-46f2-9546-35c87ef0dda3</a></p>
<h4>Get a group of POIs by bounding box</h4>
<p><span class="codehl"><a href="/openpoiwfs?request=GetFeature&service=WFS&version=1.1.0&typename=minipoi&bbox=-71.05,42.40,-71.00,42.45&srsname=epsg:4326">http://openpois.net/openpoiwfs?request=GetFeature&service=WFS&version=1.1.0&typename=minipoi&bbox=-71.05,42.40,-71.00,42.45&srsname=epsg:4326</a></p>
<p><br />
</p>
<div data-show-faces="true" data-width="450" data-send="true" data-href="http://openpois.net/api.html"
class="fb-like"></div>
<p><br />
</p>
<?php include('footer.php'); ?>
</div><!-- end ink-container -->
</body>
</html>