RadMap Goes Blank When Shapefile is used as Source

4 posts, 0 answers
  1. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 01 Mar 2012 Link to this post

    Hi there,

    I'm using the RadMap control along with a Shapefile. We're loading a background image into the Silverlight grid background property which shows fine. But then when I set the source to the shapefile and the datasource to the dbf file, the screen goes blank.

    I've tried this declaratively 
    <telerik:RadMap x:Name="MyMap" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Stretch" Background="Transparent">
        <telerik:MapProviderCollection>
            <telerik:EmptyProvider />
        </telerik:MapProviderCollection>
        <telerik:InformationLayer x:Name="RadMapInformationLayer">
            <telerik:MapShapeReader DataSource="/TestMap.Floorplan;component/Images/One2OneScale.dbf"
                    Source="/TestMap.Floorplan;component/Images/One2OneScale.shp" ClearLayer="False" />
        </telerik:InformationLayer>
    </telerik:RadMap>


    and using C# using the InformationLayer items collection,

    StreamResourceInfo shapeResourceInfo = Application.GetResourceStream(new Uri("/TestMap.Floorplan;component/Images/One2OneScale.shp", UriKind.RelativeOrAbsolute));
    StreamResourceInfo dbfResourceInfo = Application.GetResourceStream(new Uri("/TestMap.Floorplan;component/Images/One2OneScale.dbf", UriKind.RelativeOrAbsolute));
      
    List<FrameworkElement> shapes = ShapeFileReader.Read(shapeResourceInfo.Stream, dbfResourceInfo.Stream);
      
    foreach (var shape in shapes)
    {
        RadMapInformationLayer.Items.Add(shape);
    }


    both result in the screen going blank (i.e. even the navigation elements of RadMap disappear).

    The shapefile is set to use EPSG:4326 - WGS 84 for its CRS and I drew a simply polygon at a scale of 1:1. It's a single shape, nothing complex.

    Any help would be appreciated.

    Regards,
    Jacques
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 01 Mar 2012 Link to this post

    Hello Jacques,
     
    It is hard to say what is wrong with your application without your shape file. Please, open formal support (not Forum) ticket and attach your runnable solution so we could check what is wrong.
     
    Greetings,
    Andrey Murzov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Zi
    Zi avatar
    13 posts
    Member since:
    Jun 2013

    Posted 16 Jul 2013 Link to this post

    hi,Andrey
    I also got the same problem which is the applicaiton shows blank after I add the .shp file
    here is my xaml code:
    <Grid>
                <telerik:RadMap x:Name="radMap"
    Center="0.00566482542974434,-0.00197817993118133"
    ZoomLevel="17"
    MouseClickMode="None"
    UseDefaultLayout="False"
    UseSpringAnimations="False"
                            Background="Transparent"
                            IsMouseWheelZoomEnabled="True"
                            MouseDragMode="Select"
                            MouseDoubleClickMode="Center">
                    <telerik:RadMap.Provider>
                        <telerik:EmptyProvider />
                    </telerik:RadMap.Provider>
                    <telerik:InformationLayer x:Name="informationLayer">
                        <telerik:InformationLayer.ShapeFill>
                            <telerik:MapShapeFill Fill="#feee" Stroke="White" StrokeThickness="1" />
                        </telerik:InformationLayer.ShapeFill>
                        <telerik:InformationLayer.Reader>
                            <telerik:MapShapeReader ClearLayer="False"
                                               
                                                ReadCompleted="MapShapeReader_ReadCompleted"
                                                DataSource="/campus_floorplan;component/ShapeFile/level4_d_pol.dbf"
                                                Source="/campus_floorplan;component/ShapeFile/level4_d_pol.shp">
                            </telerik:MapShapeReader>
                        </telerik:InformationLayer.Reader>
                    </telerik:InformationLayer>
                </telerik:RadMap>
            </Grid>
    cs:
     public MainWindow()
            {
                InitializeComponent();
                EmptyProvider provider = new EmptyProvider();
                this.radMap.Provider = provider;
    }

    Sometimes the { DataSource="/campus_floorplan;component/ShapeFile/level4_d_pol.dbf"
                                                Source="/campus_floorplan;component/ShapeFile/level4_d_pol.shp"} will have the red line to say that "the file is not the part of this project"
    Is anything wrong about this source?
    or is my .shp is not correct?
    urgency hopely to be solved
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 17 Jul 2013 Link to this post

    Hi Zi,

    First of all, check that "Build Action" for all these files is set to "Resource". If it doesn't help, please, open a formal support (not Forum) ticket and attach your runnable solution so we could check what is wrong.

    Regards,
    Andrey Murzov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top