How to display database records using google maps in Yii2


(Jamess) #1

Hi. I am using Yii2 basic. I have a master table called District which stores DistrictId and District name. There is another table called groupdetails which stores the group details for any district. So DistrictId is the foreign key in groupdetails. Now there are records for group details for District Ahmednagar and Aurangabad. Following is the query.

select  district.District, count(*) as Groups
from groupdetails, district
where groupdetails.DistrictId = district.DistrictId
group by groupdetails.DistrictId

Now the requirement is that I want to use this query in order to display a google map which showing markers for Ahmednagar and Aurangabad and display total number of groups for each district. How to accomplish this in yii2. Are there any extension for doing or can we do it by storing latitude and longitude.