Read GPS data from thingspeak and show it in the Google map using ESP12e Nodemcu and GPS Neo 6M Module

Showing Thingspeak GPS data in Google Maps using Javascript and HTML

Introduction

In previous tutorial, we succesfully uploaded the data from Neo 6M GPS Module using ESP12E Node MCU module on the thingspeak server. In this tutorial, we are going to get the json data from the thingspeak server and parse it using HMTL and javascript to show it in Google Maps along with a marker. I hope that you already have a google or gmail account. Follow the below steps to get the Google Maps API key which will be used in our code to get the json data and show it in the marker on Google Maps.

  1. Goto https://developers.google.com/maps/documentation/javascript/get-api-key and click on "Get A Key" on the top right corner as shown in the below image.
Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (1)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (1)

2. Now Click on "Select or Create Project" in the dialog box which appears after clicking on "Get A Key" as shown below.

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (2)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (2)

 

3. Select the "Create a new project" from the list as shown below.

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (3)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (3)

4. Give a name to your project and click on "Enable API"

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (4)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (4)

5. Now you will get an API Key in a text box. Click on "copy clipboard" icon (the file on file icon) and hit "Finish". You now have Google Maps API key which you can use in your HTML code to show map.

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (5)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (5)

6. Now copy and paste the following file in notepad++ and save it as "index.html".

7. Now replace the following credentials:
1. Your copied, google api key
2. Your Thingspeak Read API key
3. Your Thingspeak Read API Key
4. Your Thingspeak Channel ID
5. Your Thingspeak Channel ID

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (6)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (6)

8. Now double click on your webpage "index.html" and wait for some time. It will take some time to load the map and marker. If you have done everything right, then you will get the following output.(blurred my location because I don't want any stalker 😀 )

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (7)

Showing-Thingspeak-GPS-data-in-Google-Maps-using-Javascript-and-HTML (7)

And here is the final output video:

Hope you like my tutorials. Please subscribe to my youtube channel for more cool tutorials.

https://www.youtube.com/channel/UCduc9YE9oZlw36YmTQ6rDEQ

 

Please login to get access to the quiz
Programming ESP12E NodeMCU Module to upload GPS data on Thingspeak (Prev Lesson)
Back to Read GPS data from thingspeak and show it in the Google map using ESP12e Nodemcu and GPS Neo 6M Module

Comments ( 2 )

  • Sha

    How do i show alarm event . I want the marker to indicate alarm occurred on the map. Eg. flood at X location which sensor gave 1 as alarm value and 0 for no alarm

    • On thingspeak, you can define ‘react’. Where if the channel meets certain condition, then it will send an sms, call or tweet. Check out ‘React’ on thingspeak

Post a Reply