How to integrate yii2 application with some maps(like a google map)

1k Views Asked by At

I have a database containing some building's GPS in my city,

i need my yii2 app to use this database in displaying a map (like a google map) containing all buildings in my database with some highlights depending on a building status.

Then my application should be able to guide users by providing directional arrows up to a specific building.

My question is, should i learn GIS to handle this situation? Or is there any simple method or library apart from GIS ? Regards.

1

There are 1 best solutions below

5
On BEST ANSWER

Example how quick start with google maps in your view https://www.w3schools.com/graphics/google_maps_intro.asp

But if you work with yii2, needed create some asset in frontend/assets like:

<?php

namespace frontend\assets;

use yii;
use yii\web\AssetBundle;

/**
 * Main frontend application asset bundle.
 */
class GoogleMapAsset extends AssetBundle
{
     public $basePath = '@webroot';
     public $baseUrl = '@web';
     public $css = [];
     public $js = [
        "https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&callback=myMap"
     ];

And in view file where you need work with google maps past GoogleMapAsset::register($this);