How to move a map marker

13 posts, 0 answers
  1. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 28 Jun 2015 Link to this post

    After I add a few markers is there a way to move the markers based on a new GPS location? Basically I want to bind the map to a datasource and show the markers. But I may add and/or remove markers being returned. When a marker is not returned is it removed from the map? And how are the markers moved? Are they just cleared and moved based on what is in the recordset returned?

    Thanks,

    Warren

     

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 01 Jul 2015 Link to this post

    Hi Warren,

    The described situation is entirely dependent on how datasource is being changed/modified. Further, teh Map should be only rebound. Although, if you are using RadClientDataSource control for data binding, RadMap should automatically detect changes done to the datasource and rebind the markers.

    Therefore, to properly get a proper answer to your question it is best to first define what is the data binding technique used, and how the markers' data would be modified by the client.

    Regards,
    Ianko
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 01 Jul 2015 in reply to Ianko Link to this post

    That s excellent. Thanks! So if I remove and add markers to the SQL table while using the amp and a datasource those new markers will then show and others will be removed when I rebind the markers?

     I will give this a try. Now I just need to look into the popup window for the markers to show information and see if I can add a button to the popup to do something such as view the details of the selected vehicle.

    Warren

     

  5. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 01 Jul 2015 Link to this post

    Hi Warren,

    You can examine in this demo (http://demos.telerik.com/aspnet-ajax/map/examples/data-binding/dataset/defaultcs.aspx) how to add HTML templates as tool tip content, thus, to add HTML button, anchor or whatever you would need.

    Regards,
    Ianko
    Telerik
  6. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 03 Jul 2015 in reply to Ianko Link to this post

    One question.. I created an aspx page with the map and I set the datasource to show markers from a table and it works great. I then added a timer on the page to rebind every 10 seconds. It displays fine on my pc but when I call the web page on my mobile app and show the web page in a webview control the page flashes when it rebinds. The page actually clears for almost a second while it rebinds. Do you know of any way to rebind without having the page flash like that? Even if I put it inside an ajax update panel won't it do the same?

    Thanks,

     Warren

     

  7. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 03 Jul 2015 in reply to Warren Link to this post

    To see if it was the web browser control in my mobile app or if it was the website I loaded the web page url into Chrome on my Android phone and it does the same thing. It flashes the whole map away and back when it is rebinding. I am calling databind on the map like this:

     RadMap1.DataBind()

    I am doing this with a timer control. Is there a better way to do this so the whole page does not flash? The reason I am binding again is the location of the markers will be changing in the sql table and I need to pull them and update the markers on the map.

    URL: www.5ttechnology.com/tmap/map104.aspx

    Thanks,

    Warren

     

  8. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 06 Jul 2015 Link to this post

    Hi Warren,

    The shared site does not open on my end.

    Did you try using AJAX to update the map?

    Can you provide a sample code to show what it is implemented?

    Regards,
    Ianko
    Telerik
  9. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 06 Jul 2015 in reply to Ianko Link to this post

    I just restarted the server and the site is coming up fast now.

    http://www.5ttechnology.com/tmap/map104.aspx

    What do you mean update with AJAX? I am using an ASP.NET timer and calling the DataBind method. I have a sqldatasource on the page that the map is using. How can I rebind with AJAX without the postback or showing it where the browser does a whole refresh and flashes like that?

    I can post the code but the web.config has my sql server connection in it. Still post it and remove that? Or I can email it to you and you can try with the connection string.

    Thanks,

    Warren

     

  10. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 06 Jul 2015 in reply to Warren Link to this post

    Btw, the map may react different depending on what browser you use. In some cases I do not see it show a flash from redrawing the map on one browser and then on another it does show more.
  11. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 06 Jul 2015 Link to this post

    Hello Warren,

    The map flickering is exactly due to the post back. If you implement logic that updates the RadMap via AJAX-controls (i.e., UpdatePanel, RadAjaxPanel or RadAjaxManager), the map will be updated without reloading the entire page. You can examine this demo—http://demos.telerik.com/aspnet-ajax/ajaxmanager/application-scenarios/ajaxify-timer/defaultcs.aspx.

    Regards,

    Ianko
    Telerik
  12. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 18 Nov 2015 in reply to Ianko Link to this post

    I know this is a late reply but yes I used your example and it works nice. The map no longer flickers and the entire page does not reload.

     I do have one question. I have the markers being called in the sqldatasource which is assigned to the map. And they do show on the map. So if I want to move a marker I just change the lat/lon in the table that is returning the marker. Is this the best way to do this? The only part I hate on this is the markers flash on each update which I assume is because each one is reset with the databind.

    Thanks!

  13. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 18 Nov 2015 Link to this post

    Hi Warren,

    I am somehow confused about the exact situation. 

    If the the map markers should be updated when the table is changed, what alternative could be available to achieve this task? I am unable to consult you on that because this entirely depends on the application requirements.

    Also, if the marker is replaced according to new data from the server, I do not see how marker's flickering or flashing would be prevented as the entire DOM element is placed to a different position.

    At all, I am quite confused on what the final results should be and what are your exact concerns on the matter. It is merely difficult to discuss programmatic tasks without sending some examples or code snippets of the troubles you encounter. 

    Also, when it comes to such tasks, it is best to be handled manually as they should be implemented according to the exact needs and requirements.

    Regards,
    Ianko
    Telerik
  14. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 25 Nov 2015 in reply to Ianko Link to this post

    I remember when I was trying to use the Google mapping and they had a method to move the markers. Basically when a marker was added it was saved in a collection and rather than just reload the markers you could then work with individual markers in the collection such as moving, removing, etc. So I was hoping that once I added a marker I could just move it. But from looking into this more I assume when the marker locations are binded say every 15 seconds it is going to remove all current markers and add them again with the new location.

    Thanks!

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017