Line does not show till click on map.

Hi,

Just started using the Map Controls.

Adding a line to a map, following the instructions in the "Virtual Earth Map Control SDK, version 3.0" help file, and compared my code to various examples.

Code runs okay (no javascript errors), loads & shows the map, but the line does not show till I click on the map.
The line will also disappear if you move the map with the navigation arrows at the top.
Same problem in IE 6 and Firefox 1.5

Example is here http://www.stroud.gov.uk/mapviewer/live_maps.htm
You can view source to see my code.

Cheers
Mike



Answer this question

Line does not show till click on map.

  • dzimmy

    Okay, I've now found a way around the polyline disappearing when the map is moved.

    On the onchangeview event, I call a function that deletes the current polyline (map.DeletePolyLine(1);) and then re-call my function to draw the polyline.

    Not the quickest way, but it works.

    http://www.stroud.gov.uk/mapviewer/live_maps.htm

    If there is a better/easier/faster solution to this, then please send your ideas!

    Thanks
    Mike


  • gqlu

    Hello again!

    I've managed to solve the problem with the line not showing till a click on the map.
    I removed this line from my code, and it now shows the line first time:
    map.SetMapView(points);

    Still have the problem where the line disappears when the map is moved usinig the navigation arrows, but I've seen that all other examples with polylines also do the same, so a "feature" I guess!
    If the map is dragged with the mouse the line is re-drawn and shows again.
    Is there anyway to refresh a polyline when the onchangeview event is fired

    Cheers
    Mike


  • Rick Hodder

    I encountered a similar behavior when calling SetMapView after adding pushpins to the map.  In my situation there were 7 pins in relatively close proximity to each other (<5 mile radius) and the zoom level was automatically adjusted such that all pins SHOULD have appeared within view, but only the LAST pin that was added to the JS array was visible.  However, as soon as I zoomed in or out at all, the other pins MAGICALLY appeared.  I should note that this issue ONLY happens in "the Fox", IE displays all the pins without further interaction with the map.

    That said, I did find a workaround (albeit not the most elegant solution) that seems to solve the problem for Firefox, which is to call the SetMapView function after each pin is added to the map instead of just calling it once after all of the pins have been added.  Again, not the most elegant solution, but it seems to do the trick.

    Zack

     



  • sapo

    I have the same problem, although there may be workarounds, there is no way this is a “feature”, this is definitely a bug in my opinion.


  • DotNetSavvy

    I have the same problem with the polyline disappearing when moving or resizing the map, have to click it to reappear, sux ***, really. But ill try your solution.

    Jeffk



  • Line does not show till click on map.