SqlGeospatialDataReader with DynamicLayers

3 posts, 0 answers
  1. Tim
    Tim avatar
    41 posts
    Member since:
    Oct 2012

    Posted 05 Mar 2014 Link to this post

    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. Tim
    Tim avatar
    41 posts
    Member since:
    Oct 2012

    Posted 05 Mar 2014 in reply to Tim Link to this post

    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.

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

    Posted 07 Mar 2014 Link to this post

    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!

Back to Top