What is the best way to track if someone has posted new location to database and without refreshing page to push that new location(marker) to map. So if I'm on a website and map has loaded. Someone creates location nearby, I would like that new marker to pop on map without me refreshing page, but If someone created new location far away from me marker won't popup.
You can achieve this easily via javascript/jquery but it pretty much depends of the following factors before you decide on the final solution: - what is your backend and database ? (PHP, node.js, MySQL, ArcGIS etc) - what traffic are we talking about ? (users viewing the map and users inserting new locations) - what latency is required for the makers to refresh ? (live, 1 sec, 5 sec etc) - are you using Google Maps API or other solution? Let me know about this so I can advice further... Best, S.
- what is your backend and database ? PHP, MySQL - what traffic are we talking about ? not sure yet, at beginning I guess traffic would be low - what latency is required for the makers to refresh ? the best would be realtime, if not 10sec max latency - are you using Google Maps API or other solution? yes Google Maps
front end > check once per second via jQuery by posting to backed the current map position, zoom level and last update time back end > get the map position and run a query on the markers table with new added markers within the radius required (use the zoom level to calculate it). Return a JSON with the markers to be rendered and generated time (use the time to query next time) database > store the markers into a table with add time stamp and coordinates. This is a short overview as I see the solution to your problem. If you need more details and code sample on the solution PM me. Hope this helps. S.