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

SqlGeospatialDataReader with DynamicLayers

2 Answers 14 Views
Map
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 05 Mar 2014, 04:30 PM
I'm currently using SqlGeospatialDataReader with InformationLayers. I would like to switch to Dynamic layers.

I'm having difficulty doing so.

Is there a sample solution that shows how to do this? I have the sample project but don't see one in there.

Basically, I'll have two datasources. When the zoom level gets close enough, I'll want to load the other one to see the smaller multiple polygons as opposed to the large ones on the initial load.

Thanks,

Tim

2 Answers, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 05 Mar 2014, 06:50 PM

Here is what I have for InformationLayers:

<telerik:InformationLayer x:Name="centerAreaLayer">
                <telerik:InformationLayer.Reader>
                    <telerik:SqlGeospatialDataReader Source="{Binding CenterAreas}"
                                                     GeospatialPropertyName="Geometry"
                                                     ToolTipFormat="Name" PreviewReadCompleted="OnPreviewReadCompleted">
                    </telerik:SqlGeospatialDataReader>
                </telerik:InformationLayer.Reader>
                <telerik:InformationLayer.ShapeFill>
                    <telerik:MapShapeFill Fill="#7FFFFFFF" Stroke="#5A636B" StrokeThickness="1" />
                </telerik:InformationLayer.ShapeFill>
                <telerik:InformationLayer.HighlightFill>
                    <telerik:MapShapeFill Fill="#B2FFFFFF" Stroke="#5A636B" StrokeThickness="1" />
                </telerik:InformationLayer.HighlightFill>
            </telerik:InformationLayer>
            <telerik:InformationLayer x:Name="centerLocationLayer">
                <telerik:InformationLayer.Reader>
                    <telerik:SqlGeospatialDataReader Source="{Binding CenterLocations}"
                                                     GeospatialPropertyName="Geometry"
                                                     ToolTipFormat="Name" >
                        <telerik:SqlGeospatialDataReader.PointTemplate>
                            <DataTemplate>
                                <Border Background="Transparent" BorderThickness="1" Padding="2,2,2,2">
                                    <telerik:MapLayer.HotSpot>
                                        <telerik:HotSpot X="0.5" Y="0.5" ElementName="PART_Image" />
                                    </telerik:MapLayer.HotSpot>
                                    <Grid Name="PART_Panel">
                                        <Path Fill="Red" Name="PART_Image" >
                                            <Path.Data>
                                                <GeometryGroup>
                                                    <EllipseGeometry Center="7,7" RadiusX="4" RadiusY="4" />
                                                    <EllipseGeometry Center="7,7" RadiusX="6" RadiusY="6" />
                                                </GeometryGroup>
                                            </Path.Data>
                                        </Path>
                                         
                                    </Grid>
                                </Border>
                            </DataTemplate>
                        </telerik:SqlGeospatialDataReader.PointTemplate>
                    </telerik:SqlGeospatialDataReader>
                </telerik:InformationLayer.Reader>
            </telerik:InformationLayer>
            <telerik:InformationLayer x:Name="zipAreaLayer">
                <telerik:InformationLayer.Reader>
                    <telerik:SqlGeospatialDataReader Source="{Binding ZipAreas}"
                                                     GeospatialPropertyName="Geometry"
                                                     ToolTipFormat="Name" PreviewReadCompleted="OnPreviewZipReadCompleted">
                    </telerik:SqlGeospatialDataReader>
                </telerik:InformationLayer.Reader>
                <telerik:InformationLayer.ShapeFill>
                    <telerik:MapShapeFill  Stroke="#5A636B" StrokeThickness="2" />
                </telerik:InformationLayer.ShapeFill>
                <telerik:InformationLayer.HighlightFill>
                    <telerik:MapShapeFill Fill="Yellow" Stroke="#5A636B" StrokeThickness="1" />
                </telerik:InformationLayer.HighlightFill>
 
            </telerik:InformationLayer>


The CenterArea and ZipArea are what I'd want to be in a DynamicLayer with the other CenterLocation to always be shown.
Hope this helps in what I'm attempting to do.

0
Andrey
Telerik team
answered on 07 Mar 2014, 05:11 PM
Hello Tim,

 As we advised you in the other forum thread you started, it is best to use the VisualizationLayer in your case.

Please, find an attached example which demonstrates an approach which can be implemented to show map shapes from different files depending on the zoom level. It uses ESRI shape files for demonstration purposes (as I don’t have a usable SQL Geospatial data at hand), but you should be able to easily modify the code to use your SQL Geospatial data instead.

Regards,
Andrey Murzov
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

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