RadMap Q3 2011 SqlGeospatialDataReader Source Binding

5 posts, 0 answers
  1. Christopher
    Christopher avatar
    4 posts
    Member since:
    May 2011

    Posted 09 May 2012 Link to this post

    Hello,

    I am currently using RadMap with the OpenStreetMapProvider and the SqlGeospatialDataReader. The SqlGeospatialDataReader Source is bound to an observable collection called MapData, and each element within the MapData collection contains the GeoSpatial property called BorderWKT of type string and
    some additional properties that I have defined within the ExtendedPropertySet.

    When the RadMap first loads it displays all of the GeoSpatial data correctly on the map and looks great. However, when I then modify the MapData collection with new values, the map does not re-draw the new data (the set method on the MapData collection calls NotifyPropertyChanged).

    Here is an extract of my RadMap in xaml: <
    telerik:RadMap x:Name="RegionMap" ScaleVisibility="Collapsed" Margin="0" HorizontalContentAlignment="Stretch" UseSpringAnimations="False"                  UseDefaultLayout="False" MouseClickMode="None" MouseDoubleClickMode="ZoomToPoint" MouseDragMode="Drag"                  Background="{StaticResource MapBackgroundBrush}">                     <telerik:RadMap.Provider>                         <telerik:OpenStreetMapProvider/>                     </telerik:RadMap.Provider>                     <telerik:InformationLayer x:Name="informationLayer" >                         <telerik:InformationLayer.Reader>                             <telerik:SqlGeospatialDataReader x:Name="sqlGeospatialDataReader" ReadCompleted="sqlGeospatialDataReader_ReadCompleted"                                                              ExtendedPropertySet="RegionID,int RegionCode,string RegionName,string ProjR1K,double"                                                              Source="{Binding MapData}" GeospatialPropertyName="BorderWKT" ToolTipTemplate="{StaticResource RegionR1KMapTooltip}" />                         </telerik:InformationLayer.Reader>                         <telerik:InformationLayer.Colorizer>                             <telerik:ColorMeasureScale ExtendedPropertyName="ProjR1K" Mode="Count" TickMarkCount="10">                                 <telerik:ColorMeasureScale.ShapeFillCollection>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush1}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush2}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush3}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush4}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush5}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush6}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush7}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush8}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush9}"/>                                     <telerik:MapShapeFill Fill="{StaticResource MapBrush10}"/>                                 </telerik:ColorMeasureScale.ShapeFillCollection>                             </telerik:ColorMeasureScale>                         </telerik:InformationLayer.Colorizer>                     </telerik:InformationLayer> </telerik:RadMap> I also put a ReadCompleted event handler on the SqlGeospatialDataReader in the code behind. When I put a break point on this method it is hit every time the MapData collection is modified. By investigating the Sender argument of the method I noticed that it always contains the updated MapData values. So it would appear the collection is being read properly by the SqlGeospatialDataReader, but the map shapes are not being re-drawn?
    Thanks, Christopher
  2. Christopher
    Christopher avatar
    4 posts
    Member since:
    May 2011

    Posted 11 May 2012 Link to this post

    Anyone got any answers to this please?

    Thanks.
  3. DevCraft banner
  4. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 May 2012 Link to this post

    Hello Christopher,

    Thank you for the feedback.
    We were able to reproduce the problem. It occurs when SqlGeospatialDataReader.Source property is bound to an observable collection and the ExtendedPropertySet is defined. We will fix it. The fix will be available in the nearest internal build.
    If you change a whole collection to show new data, then as workaround you can use the Collection<> type instead of ObservableCollection<> for your MapData property.

    Regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Christopher
    Christopher avatar
    4 posts
    Member since:
    May 2011

    Posted 14 May 2012 Link to this post

    Hi Andrey,

    Thanks for your response and advice. I have modified MapData to be a Collection<> like you said and it is now drawing the map polygons properly.

    However, just to inform you, it also appears that the Information Layers Colourizer that I have defined does not update the MaxValue and MinValue based on the new MapData (Collection<>). I have worked around this for the time being by manually setting the MaxValue and MinValue values myself programatically.

    I look forward to your fix in the next internal build.

    Regards,

    Christopher
  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 17 May 2012 Link to this post

    Hi Christopher,

    You can just reset the MaxValue and MinValue to double.NaN before you assign new collection to MapData. In this case they will be recalculated. The sample code is below.
    ColorMeasureScale scale = this.InformationLayer.Colorizer as ColorMeasureScale;
    scale.MinValue = scale.MaxValue = double.NaN;

    Kind regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner