Created
September 22, 2016 04:21
-
-
Save roy-bukapeta/318d7146813c8cf6c2cbbbe836b36660 to your computer and use it in GitHub Desktop.
Function openlayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function ScriptOpenlayers(){ | |
/*** | |
* Script dasar openlayers | |
***/ | |
$setView = explode(",", $this->options['setView']); | |
$view = $this->getView(); | |
$view->registerJs(" | |
var map".$this->id." = new ol.Map({ | |
target: 'map".$this->id."', | |
layers: [ | |
new ol.layer.Tile({ | |
source: new ol.source.XYZ({ | |
url: 'https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiLWhhYmliLSIsImEiOiJjaWdjbmpsZzE0MXM3dmptM3NzN292NWVhIn0.AfZ7s3jnuqK-2nPzbfl7IA' | |
}) | |
}) | |
], | |
view: new ol.View({ | |
projection: 'EPSG:4326', | |
center: [" . $setView[1] . ", " . $setView[0] . "], | |
zoom: " . $this->options['setZoom'] . ", | |
maxResolution: 0.703125 | |
}) | |
}); | |
", \yii\web\View::POS_END); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment