This is a migrated thread and some comments may be shown as answers.

RadMap Q3 2011 SqlGeospatialDataReader Source Binding

4 Answers 183 Views
Map
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 09 May 2012, 12:19 PM
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

4 Answers, 1 is accepted

Sort by
0
Christopher
Top achievements
Rank 1
answered on 11 May 2012, 11:01 AM
Anyone got any answers to this please?

Thanks.
0
Andrey
Telerik team
answered on 14 May 2012, 09:11 AM
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 >>

0
Christopher
Top achievements
Rank 1
answered on 14 May 2012, 03:42 PM
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
0
Andrey
Telerik team
answered on 17 May 2012, 09:27 AM
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 >>

Tags
Map
Asked by
Christopher
Top achievements
Rank 1
Answers by
Christopher
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or