@@ -42,7 +42,7 @@ Nominatim | yes | supported | worldwide | requires a domain name (e.g. local
42
42
[ Geonames] ( http://www.geonames.org/commercial-webservices.html ) | yes |no | worldwide | requires registration, no free tier
43
43
[ TomTom] ( https://geocoder.tomtom.com/app/view/index ) | yes | required | worldwide | requires API key. First 2500 requests or 30 days free
44
44
[ ArcGIS Online] ( https://developers.arcgis.com/en/features/geocoding/ ) | yes | supported | worldwide | requires API key. 1250 requests free
45
- ChainProvider | | | | meta provider which iterates over a list of providers
45
+ Chain | | | | meta provider which iterates over a list of providers
46
46
47
47
48
48
IP-based geocoding
@@ -115,118 +115,118 @@ $adapter = new \Geocoder\HttpAdapter\BuzzHttpAdapter($buzz);
115
115
Now, you have to choose a ` provider ` which is closed to what you want to get.
116
116
117
117
118
- ### FreeGeoIpProvider ###
118
+ ### FreeGeoIp ###
119
119
120
- The ` FreeGeoIpProvider ` named ` free_geo_ip ` is able to geocode ** IPv4 and IPv6
120
+ The ` FreeGeoIp ` named ` free_geo_ip ` is able to geocode ** IPv4 and IPv6
121
121
addresses** only.
122
122
123
123
124
- ### HostIpProvider ###
124
+ ### HostIp ###
125
125
126
- The ` HostIpProvider ` named ` host_ip ` is able to geocode ** IPv4 addresses** only.
126
+ The ` HostIp ` named ` host_ip ` is able to geocode ** IPv4 addresses** only.
127
127
128
128
129
- ### IpInfoDbProvider ###
129
+ ### IpInfoDb ###
130
130
131
- The ` IpInfoDbProvider ` named ` ip_info_db ` is able to geocode ** IPv4 addresses**
131
+ The ` IpInfoDb ` named ` ip_info_db ` is able to geocode ** IPv4 addresses**
132
132
only. A valid api key is required.
133
133
134
134
135
- ### GoogleMapsProvider ###
135
+ ### GoogleMaps ###
136
136
137
- The ` GoogleMapsProvider ` named ` google_maps ` is able to geocode and reverse
137
+ The ` GoogleMaps ` named ` google_maps ` is able to geocode and reverse
138
138
geocode ** street addresses** . A locale and a region can be set as well as an
139
139
optional api key. This provider also supports SSL.
140
140
141
141
142
- ### GoogleMapsBusinessProvider ###
142
+ ### GoogleMapsBusiness ###
143
143
144
- The ` GoogleMapsBusinessProvider ` named ` google_maps_business ` is able to geocode
144
+ The ` GoogleMapsBusiness ` named ` google_maps_business ` is able to geocode
145
145
and reverse geocode ** street addresses** . A valid ` Client ID ` is required. The
146
146
private key is optional. This provider also supports SSL.
147
147
148
148
149
- ### BingMapsProvider ###
149
+ ### BingMaps ###
150
150
151
- The ` BingMapsProvider ` named ` bing_maps ` is able to geocode and reverse geocode
151
+ The ` BingMaps ` named ` bing_maps ` is able to geocode and reverse geocode
152
152
** street addresses** . A valid api key is required.
153
153
154
154
155
- ### OpenStreetMapProvider ###
155
+ ### OpenStreetMap ###
156
156
157
- The ` OpenStreetMapProvider ` named ` openstreetmap ` is able to geocode and reverse
157
+ The ` OpenStreetMap ` named ` openstreetmap ` is able to geocode and reverse
158
158
geocode ** street addresses** .
159
159
160
160
161
- ### NominatimProvider ###
161
+ ### Nominatim ###
162
162
163
- The ` NominatimProvider ` named ` nominatim ` is able to geocode and reverse geocode
163
+ The ` Nominatim ` named ` nominatim ` is able to geocode and reverse geocode
164
164
** street addresses** . Access to a Nominatim server is required. See the
165
165
[ Nominatim Wiki Page] ( http://wiki.openstreetmap.org/wiki/Nominatim ) for more
166
166
information.
167
167
168
168
169
- ### GeoipProvider ###
169
+ ### Geoip ###
170
170
171
- The ` GeoipProvider ` named ` geoip ` is able to geocode ** IPv4 and IPv6 addresses**
171
+ The ` Geoip ` named ` geoip ` is able to geocode ** IPv4 and IPv6 addresses**
172
172
only. No need to use an ` HttpAdapter ` as it uses a local database. See the
173
173
[ MaxMind page] ( http://www.maxmind.com/app/php ) for more information.
174
174
175
175
176
- ### ChainProvider ###
176
+ ### Chain ###
177
177
178
- The ` ChainProvider ` named ` chain ` is a special provider that takes a list of
178
+ The ` Chain ` named ` chain ` is a special provider that takes a list of
179
179
providers and iterates over this list to get information.
180
180
181
181
182
- ### MapQuestProvider ###
182
+ ### MapQuest ###
183
183
184
- The ` MapQuestProvider ` named ` map_quest ` is able to geocode and reverse geocode
184
+ The ` MapQuest ` named ` map_quest ` is able to geocode and reverse geocode
185
185
** street addresses** . A valid api key is required. Access to [ MapQuest's
186
186
licensed
187
187
endpoints] ( http://developer.mapquest.com/web/tools/getting-started/platform/licensed-vs-open )
188
188
is provided via constructor argument.
189
189
190
190
191
- ### OpenCageProvider ###
191
+ ### OpenCage ###
192
192
193
- The ` OpenCageProvider ` named ` opencage ` is able to geocode and reverse geocode
193
+ The ` OpenCage ` named ` opencage ` is able to geocode and reverse geocode
194
194
** street addresses** . A valid api key is required.
195
195
196
196
197
- ### YandexProvider ###
197
+ ### Yandex ###
198
198
199
- The ` YandexProvider ` named ` yandex ` is able to geocode and reverse geocode
199
+ The ` Yandex ` named ` yandex ` is able to geocode and reverse geocode
200
200
** street addresses** . The default language-locale is ` ru-RU ` , you can choose
201
201
between ` uk-UA ` , ` be-BY ` , ` en-US ` , ` en-BR ` and ` tr-TR ` . This provider can also
202
202
reverse information based on coordinates (latitude, longitude). It's possible to
203
203
precise the toponym to get more accurate result for reverse geocoding: ` house ` ,
204
204
` street ` , ` metro ` , ` district ` and ` locality ` .
205
205
206
206
207
- ### GeoPluginProvider ###
207
+ ### GeoPlugin ###
208
208
209
- The ` GeoPluginProvider ` named ` geo_plugin ` is able to geocode ** IPv4 addresses
209
+ The ` GeoPlugin ` named ` geo_plugin ` is able to geocode ** IPv4 addresses
210
210
and IPv6 addresses** only.
211
211
212
212
213
- ### GeoIPsProvider ###
213
+ ### GeoIPs ###
214
214
215
- The ` GeoIPsProvider ` named ` geo_ips ` is able to geocode ** IPv4 addresses** only.
215
+ The ` GeoIPs ` named ` geo_ips ` is able to geocode ** IPv4 addresses** only.
216
216
A valid api key is required.
217
217
218
218
219
- ### MaxMindProvider ###
219
+ ### MaxMind ###
220
220
221
- The ` MaxMindProvider ` named ` maxmind ` is able to geocode ** IPv4 and IPv6
221
+ The ` MaxMind ` named ` maxmind ` is able to geocode ** IPv4 and IPv6
222
222
addresses** only. A valid ` City/ISP/Org ` or ` Omni ` service's api key is
223
223
required. This provider provides two constants ` CITY_EXTENDED_SERVICE ` by
224
224
default and ` OMNI_SERVICE ` .
225
225
226
226
227
- ### MaxMindBinaryProvider ###
227
+ ### MaxMindBinary ###
228
228
229
- The ` MaxMindBinaryProvider ` named ` maxmind_binary ` is able to geocode ** IPv4 and
229
+ The ` MaxMindBinary ` named ` maxmind_binary ` is able to geocode ** IPv4 and
230
230
IPv6 addresses** only. It requires a data file, and the
231
231
[ geoip/geoip] ( https://packagist.org/packages/geoip/geoip ) package must be
232
232
installed.
@@ -235,16 +235,16 @@ It is worth mentioning that this provider has **serious performance issues**,
235
235
and should ** not** be used in production. For more information, please read
236
236
[ issue #301 ] ( https://github.com/geocoder-php/Geocoder/issues/301 ) .
237
237
238
- ### GeoIP2DatabaseProvider ###
238
+ ### GeoIP2Database ###
239
239
240
- The ` GeoIP2Provider ` named ` maxmind_geoip2 ` is able to geocode ** IPv4 and IPv6
240
+ The ` GeoIP2 ` named ` maxmind_geoip2 ` is able to geocode ** IPv4 and IPv6
241
241
addresses** only - it makes use of the MaxMind GeoIP2 databases or the
242
242
webservice.
243
243
244
244
It requires either the [ database
245
245
file] ( http://dev.maxmind.com/geoip/geoip2/geolite2/ ) , or the
246
246
[ webservice] ( http://dev.maxmind.com/geoip/geoip2/web-services/ ) - represented by
247
- the GeoIP2 Provider , which is injected to the ` GeoIP2Adapter ` . The
247
+ the GeoIP2 , which is injected to the ` GeoIP2Adapter ` . The
248
248
[ geoip2/geoip2] ( https://packagist.org/packages/geoip2/geoip2 ) package must be
249
249
installed.
250
250
@@ -259,27 +259,27 @@ This provider will only work with the corresponding `GeoIP2Adapter`.
259
259
$reader = new \GeoIp2\Database\Reader('/path/to/database');
260
260
261
261
$adapter = new \Geocoder\HttpAdapter\GeoIP2Adapter($reader);
262
- $provider = new \Geocoder\Provider\GeoIP2Provider ($adapter);
262
+ $provider = new \Geocoder\Provider\GeoIP2 ($adapter);
263
263
$geocoder = new \Geocoder\Geocoder($provider);
264
264
265
265
$address = $geocoder->geocode('74.200.247.59');
266
266
```
267
267
268
- ### GeonamesProvider ###
268
+ ### Geonames ###
269
269
270
- The ` GeonamesProvider ` named ` geonames ` is able to geocode and reverse geocode
270
+ The ` Geonames ` named ` geonames ` is able to geocode and reverse geocode
271
271
** places** . A valid username is required.
272
272
273
- ### TomTomProvider ###
273
+ ### TomTom ###
274
274
275
- The ` TomTomProvider ` named ` tomtom ` is able to geocode and reverse geocode
275
+ The ` TomTom ` named ` tomtom ` is able to geocode and reverse geocode
276
276
** street addresses** . The default langage-locale is ` en ` , you can choose
277
277
between ` de ` , ` es ` , ` fr ` , ` it ` , ` nl ` , ` pl ` , ` pt ` and ` sv ` . A valid api key is
278
278
required.
279
279
280
- ### ArcGISOnlineProvider ###
280
+ ### ArcGISOnline ###
281
281
282
- The ` ArcGISOnlineProvider ` named ` arcgis_online ` is able to geocode and reverse
282
+ The ` ArcGISOnline ` named ` arcgis_online ` is able to geocode and reverse
283
283
geocode ** street addresses** . It's possible to specify a sourceCountry to
284
284
restrict result to this specific country thus reducing request time (note that
285
285
this doesn't work on reverse geocoding). This provider also supports SSL.
@@ -295,56 +295,55 @@ providers and decide later. That's we'll do:
295
295
296
296
$geocoder = new \Geocoder\ProviderBasedGeocoder();
297
297
$geocoder->registerProviders(array(
298
- new \Geocoder\Provider\GoogleMapsProvider (
298
+ new \Geocoder\Provider\GoogleMaps (
299
299
$adapter, $locale, $region, $useSsl
300
300
),
301
- new \Geocoder\Provider\GoogleMapsBusinessProvider (
301
+ new \Geocoder\Provider\GoogleMapsBusiness (
302
302
$adapter, '<CLIENT _ID >', '<PRIVATE _KEY >', $locale, $region, $useSsl
303
303
),
304
- new \Geocoder\Provider\YandexProvider (
304
+ new \Geocoder\Provider\Yandex (
305
305
$adapter, $locale, $toponym
306
306
),
307
- new \Geocoder\Provider\MaxMindProvider (
307
+ new \Geocoder\Provider\MaxMind (
308
308
$adapter, '<MAXMIND _API_KEY >', $service, $useSsl
309
309
),
310
- new \Geocoder\Provider\ArcGISOnlineProvider (
310
+ new \Geocoder\Provider\ArcGISOnline (
311
311
$adapter, $sourceCountry, $useSsl
312
312
),
313
- new \Geocoder\Provider\NominatimProvider (
313
+ new \Geocoder\Provider\Nominatim (
314
314
$adapter, 'http://your.nominatim.server', $locale
315
315
),
316
316
));
317
317
```
318
318
319
319
Parameters:
320
320
321
- * ` $locale ` is available for ` YandexProvider ` , ` BingMapsProvider ` ,
322
- ` OpenCageProvider ` and ` TomTomProvider `
323
- * ` $region ` is available for ` GoogleMapsProvider ` and
324
- ` GoogleMapsBusinessProvider `
325
- * ` $toponym ` is available for ` YandexProvider `
326
- * ` $service ` is available for ` MaxMindProvider `
327
- * ` $useSsl ` is available for ` GoogleMapsProvider ` , ` GoogleMapsBusinessProvider ` ,
328
- ` OpenCageProvider ` , ` MaxMindProvider ` and ` ArcGISOnlineProvider `
329
- * ` $sourceCountry ` is available for ` ArcGISOnlineProvider `
330
- * ` $rootUrl ` is available for ` NominatimProvider `
321
+ * ` $locale ` is available for ` Yandex ` , ` BingMaps ` ,
322
+ ` OpenCage ` and ` TomTom `
323
+ * ` $region ` is available for ` GoogleMaps ` and
324
+ ` GoogleMapsBusiness `
325
+ * ` $toponym ` is available for ` Yandex `
326
+ * ` $service ` is available for ` MaxMind `
327
+ * ` $useSsl ` is available for ` GoogleMaps ` , ` GoogleMapsBusiness ` ,
328
+ ` OpenCage ` , ` MaxMind ` and ` ArcGISOnline `
329
+ * ` $sourceCountry ` is available for ` ArcGISOnline `
330
+ * ` $rootUrl ` is available for ` Nominatim `
331
331
332
- ### Using The ChainProvider ###
332
+ ### Using The Chain Provider ###
333
333
334
334
As said it's a special provider that takes a list of providers and iterates over
335
335
this list to get information. Note that it ** stops** its iteration when a
336
- provider returns a result. The result is returned by ` GoogleMapsProvider `
337
- because ` FreeGeoIpProvider ` and ` HostIpProvider ` cannot geocode street
338
- addresses. ` BingMapsProvider ` is ignored.
336
+ provider returns a result. The result is returned by ` GoogleMaps ` because
337
+ ` FreeGeoIp ` and ` HostIp ` cannot geocode street addresses. ` BingMaps ` is ignored.
339
338
340
339
``` php
341
340
$geocoder = new \Geocoder\ProviderBasedGeocoder();
342
341
$adapter = new \Geocoder\HttpAdapter\CurlHttpAdapter();
343
- $chain = new \Geocoder\Provider\ChainProvider (array(
344
- new \Geocoder\Provider\FreeGeoIpProvider ($adapter),
345
- new \Geocoder\Provider\HostIpProvider ($adapter),
346
- new \Geocoder\Provider\GoogleMapsProvider ($adapter, 'fr_FR', 'France', true),
347
- new \Geocoder\Provider\BingMapsProvider ($adapter, '<API _KEY >'),
342
+ $chain = new \Geocoder\Provider\Chain (array(
343
+ new \Geocoder\Provider\FreeGeoIp ($adapter),
344
+ new \Geocoder\Provider\HostIp ($adapter),
345
+ new \Geocoder\Provider\GoogleMaps ($adapter, 'fr_FR', 'France', true),
346
+ new \Geocoder\Provider\BingMaps ($adapter, '<API _KEY >'),
348
347
// ...
349
348
));
350
349
$geocoder->registerProvider($chain);
0 commit comments