Geocoding - Elektromann/yii2-openlayers-maps GitHub Wiki
About
You can use Nominatim or Bing Maps geocoding. By default Nominatim geocoding is set. If you set Bing Maps map type, the widget use Bing Maps geocoding type. You can set your own geocoding options. The widget can use both at the same time.
Nominatim geocoding
It is default, but the widget by automatically switch to Bing Maps geocoding type. You can set Nominatim geocoding if you prefer this.
<?= \elektromann\openlayers\Map::widget([
'type' => \elektromann\openlayers\Map::TYPE_BINGMAPS,
'center' => "London",
'geocoding' => [
\elektromann\openlayers\Map::GEOCODING_NOMINATIM,
],
]); ?>
Bing Maps geocoding
When you use free map type, you can set geocoding type to Bing Maps geocoding but you need API key. About API key, click here.
If you set API key in config
<?= \elektromann\openlayers\Map::widget([
'center' => "London",
'geocoding' => [
\elektromann\openlayers\Map::GEOCODING_BINGMAPS,
],
]); ?>
or enter your API key in the geocoding option
<?= \elektromann\openlayers\Map::widget([
'center' => "London",
'geocoding' => [
\elektromann\openlayers\Map::GEOCODING_BINGMAPS,
'apiKey' => "Your API key",
],
]); ?>
Geocoding requests are limited. About this click here to read more. By default limit is 1 job at the same time but you can change it.
<?= \elektromann\openlayers\Map::widget([
'center' => "London",
'geocoding' => [
\elektromann\openlayers\Map::GEOCODING_BINGMAPS,
'apiKey' => "Your API key",
'limit' => 2,
],
]); ?>