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

How to achieve some functionality offered by Dinamy Layer with MapShapeDataVirtualizationSource?

1 Answer 36 Views
Map
This is a migrated thread and some comments may be shown as answers.
Alice
Top achievements
Rank 1
Alice asked on 27 Jun 2014, 08:30 AM
Use of VisualizationLayer (with VirtualizationSource and AsyncShapeFileReader) facilitates work with RadMap control and have a lot of advantages compared with Dynamic Layer (improved performance, asyncronous shape loading, virtualization). But I don't get how to achieve a functionality provided by Dynamic Layer with VisualizationLayer.

<telerik:VisualizationLayer x:Name="visualizationLayer">
    <telerik:VisualizationLayer.VirtualizationSource>
        <telerik:MapShapeDataVirtualizationSource ClearCache="False" >
            <telerik:MapShapeDataVirtualizationSource.Reader>
                <telerik:AsyncShapeFileReader x:Name="asyncShapeFileReader"/>
            </telerik:MapShapeDataVirtualizationSource.Reader>
        </telerik:MapShapeDataVirtualizationSource>
    </telerik:VisualizationLayer.VirtualizationSource>
    <telerik:VisualizationLayer.ZoomLevelGridList>
        <telerik:ZoomLevelGrid MinZoom="5" />
        <telerik:ZoomLevelGrid MinZoom="10" />
        <telerik:ZoomLevelGrid MinZoom="15" />
        <telerik:ZoomLevelGrid MinZoom="20" />
    </telerik:VisualizationLayer.ZoomLevelGridList>
</telerik:VisualizationLayer>


1) I load some initial shapefiles with AsyncShapeFileReader, but when I try to add some additional shape files to AsyncShapeFileReader.SourceCollection and call AsyncShapeFileReader.ReadAsync() method, they don't appear on the map. Moreover when I try to remove existing shapefiles from AsyncShapeFileReader.SourceCollection and call VisualizationLayer.RefreshVirtualSource() method, they still displayed on the map. Is it possible to load and unload shapefiles with MapShapeDataVirtualizationSource during the program execution?

2) MapPinPoint (used by old visualization engine) has ImageSource property. Is there any way to set ImageSource to PointData instance and change the default item template?

3) What is the right way to hide/show and add/remove several shape features (loaded with MapShapeDataVirtualizationSource) depending on map zoom level or other events? In Dynamic layer you can handle it inside ItemsRequest() method.
For example, I loaded a shape file with PointData instances that are visible on all zoom levels. Is there a way to automatically hide them if zoom level comes to some level.
Another example, how to display on the map only some filtered by user shape features and hide all the rest?

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 27 Jun 2014, 01:06 PM
Hello Alice,

The MapShapeVirtualizationSource class is just a one of the possible implementations of the IMapItemsVirtualizationSource interface. It serves many common scenarios but it is not an universal solution for all existing ones.

As I can see from your 3-rd question it will not work for your scenario. So, I would recommend you to look at the Map Shapes Virtualization article. It demonstrates a custom implementation of the IMapItemsVirtualizationSource interface which shows data depending on the zoom level.

You can use the VisualizationLayer.ItemTemplate property to change the default item template for points. Or you can use the VisualizationLayer.ItemTemplateSelector when you want to use different templates for different points.

Regards,
Andrey Murzov
Telerik

 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Map
Asked by
Alice
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or