0

while I can place a marker on the Google Map for single set of co-ordinates like

<iframe
  width="100%"
  height="450"
  frameborder="0" style="border:0"
  src="https://www.google.com/maps/embed/v1/place?key=mykey
    &q=<?=$model->latitude_out ?>,<?= $model->longitude_out?>" >
</iframe>

I am not able to make out, how I can make a location history like googleMap timeline(history). I have pulled the coordinates for geo-locations and stored the same in the database.

for example the array of location my db is like this:

"location_positions" : [ { "locationTime" : "04-06-2020 02:54", "Latitude" : null, "Longitude" : null }, { "locationTime" : "04-06-2020 02:56", "Latitude" : null, "Longitude" : null }, { "locationTime" : "04-06-2020 02:57", "Latitude" : null, "Longitude" : null }, { "locationTime" : "04-06-2020 02:58", "Latitude" : "21.4626999", "Longitude" : "83.9729724" } ]

Now how I can plot this coordinates in a line - example images.

enter image description here

No I am not getting the result with the polygon as suggested in the answer. The result I am getting is like in the image below, whereas my actual movement is denoted by green line.

enter image description here

I need the result as in my first picture.

1 Answer 1

1

What you want to do is to create a function which will draw polylines based on your geolocation data.

Instead of loading your map in an iframe, you will load it via a script, with a callback to the function you will provide to draw the polylines.

All of this is well documented in the official Google api:

https://developers.google.com/maps/documentation/javascript/examples/polyline-complex

(link updated following feedback)

Sign up to request clarification or add additional context in comments.

2 Comments

I am sorry, but the solution you suggested is not giving the result as expected. I have added the result image in question.
Sorry, your answer is correct, only the link is wrong. simple poyline gives the expected result, but your link is to polygon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.