1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Track new locations in database and push markers on map

Discussion in 'Google API' started by Kuna, Mar 26, 2014.

  1. #1
    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.
    SEMrush
    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.
     
    Kuna, Mar 26, 2014 IP
    SEMrush
  2. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #2
    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.
     
    shmekerosu, Apr 27, 2014 IP
  3. Kuna

    Kuna Active Member

    Messages:
    415
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #3
    - 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
     
    Kuna, Apr 27, 2014 IP
  4. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #4
    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.
     
    shmekerosu, May 3, 2014 IP