1
That is the scenario:
For example, if I wanted to show all the homes of users of a city (those who are registered in the system) it would be enough to make a request in the database before the page is loaded, retrieve the geographical coordinates that were previously provided by users during the signup process, and send to javascript when using the API to instantiate the map. This is how I currently do with my projects.
My question would be how to show in real time the displacement of any user on that same map previously created? How to implement this functionality?
you need to update the user’s position (assuming you want to track the phone via gps, for example) and redraw the points on the map. I state this procedure because you do not need to control one to which marker moved every x seconds (time the map is updated.
– rLinhares
exact, it would be via cell phone gps to send the coordinates of the point. Preferably would be every second. And I’d like to see on the map all the registered sites moving at the same time. [It’s for a mass displacement study, so you need to visualize all users in real time. But how would it be implemented? Update the map every second or there is some function for it?
– zwitterion
so I did a search if there’s any auto-update mechanism but I couldn’t find it.. I’ve implemented it and it was on hand anyway..
window.setTimeout("AtualizarTela()", 30000);
where my map update method was called every 30 seconds (this method will at the base take the updated position data and reload the map)– rLinhares
Hi @rLinhares I’ve worked with the google map API. The most dynamic I could do was to create a php page that takes the information in a database and dynamically creates the javascript code (there are other ways). That way when the map is created on the screen it will already contain the latest information of my points of interest. So this page was reloaded every minute. That is, every minute the map was recreated. I was working with information (which could change) but from a fixed establishment. The coordinates of my point of interest do not change. Now it’s the other way around
– zwitterion
Anyway, if I wanted to see in real time the displacement of a person who owns a mobile phone sending the geographical coordinates to the system every second, your proposal would be to refresh the page every second?
– zwitterion
the idea is the same that you worked, reload the points on the map every x seconds. The difference is that you need to update these points according to the current position of the guy who is moving.
– rLinhares
ok, so the idea would be to delete all the dots and create again every second and on recreating the map again
– zwitterion
this.. so you don’t "spend" the map requests and you don’t waste time recreating the map
– rLinhares