Real Time marker updating in WPF MVVM Fork

Topics: WPF
Sep 14, 2012 at 12:24 PM
Edited Sep 14, 2012 at 12:29 PM

Hey guys.

I am using the map as a control to show real time events happening and trying to capture or track them using a GMapMarker.

We achieve this behavior getting a lat-long position from equipment in the field, and then serializing it, and sending it to a "controller". The controller then deserialize the data and construct a GMapMarker and adds it to the thread safe observable collection. The collection is bound to the WPF Map controls item collection.

The problems we encounter is the following:

1) When i add to the observable collection the map only draws the GMapMarker when i move the map, or zoom. The observable collection does not force a redraw on the map. Is there a way that we can force this behavior?

2) The Lat-Long coordinates of the GMapMarker acts strangely. When i introduce an incremental '15 position update to each coordinate the first marker is placed on the bottom right of the screen and the rest of the markers act around the first ones reference.

I have tried to update the Map Location to that of the new coordinates but  WPF does not update to reflect the change.

WPF:

 <gmap:GMapControl  x:Name="MainMap" MapProvider="{x:Static prov:GMapProviders.GoogleSatelliteMap}"
                           Zoom="{Binding ZoomLevel}" MaxZoom="17" MinZoom="1" 
                           Position="{Binding Location, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           ItemsSource="{Binding Path=Markers, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" >
                <gmap:GMapControl.ItemTemplate>
                    <DataTemplate>
                        <Border Width="15" Height="15" CornerRadius="4" Background="Red" />
                    </DataTemplate>
                </gmap:GMapControl.ItemTemplate>
              
 </gmap:GMapControl>

 

Controller:

Location = new PointLatLng(-25.744501, 28.272616);
Markers.Add(new GMapMarker(new PointLatLng(-25.744501, 28.272616)));

Map:

https://www.dropbox.com/s/6k32k4ebdef4ve5/gmap.png

Coordinator
Sep 14, 2012 at 12:38 PM

i can assist you only with the latest 'official' version