elektromann/yii2-openlayers-maps

Use free maps in your site

Installs: 9 668

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 2

Language:JavaScript

Type:yii2-extension

v1.2.0 2019-06-18 16:53 UTC

This package is auto-updated.

Last update: 2024-04-19 03:43:14 UTC


README

Use free maps in your site

Yii2 OpenLayers Maps wiki pages

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist elektromann/yii2-openlayers-maps "*"

or add

"elektromann/yii2-openlayers-maps": "*"

to the require section of your composer.json file.

Usage

Show simple map

This will show a map.

<?= \elektromann\openlayers\Map::widget(); ?>

Set map center position

You can use longitude and latitude (LonLat) coordinates to set position.

<?= \elektromann\openlayers\Map::widget([
    'center' => [-0.1276474, 51.5073219], //London
]); ?>

Or you can use address to find coordinates by geocoding.

<?= \elektromann\openlayers\Map::widget([
    'center' => "London",
]); ?>

Show multi maps

To show multi maps echo more widgets.

<?= \elektromann\openlayers\Map::widget([
    'center' => "London",
]); ?>
<?= \elektromann\openlayers\Map::widget([
    'center' => [13.3888599, 52.5170365], //Berlin
]); ?>

Add markers to the map

You can add markers to the map.

<?= \elektromann\openlayers\Map::widget([
    'center' => [-0.1276474, 51.5073219],
    'markers' => [
        [], //Marker in the map center
        [
            'center' => "London, Bond street", //Set marker position
            'title' => "Bond street here", //Title of the marker
            'description' => "You can see Bond street", //Show wher one click on marker
        ],
    ]
]); ?>

More informations

For other options and informations visit wiki.