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

RadMap Goes Blank When Shapefile is used as Source

3 Answers 121 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 2
Jacques asked on 01 Mar 2012, 09:07 AM
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

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 01 Mar 2012, 10:37 AM
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 >>
0
Zi
Top achievements
Rank 1
answered on 17 Jul 2013, 03:52 AM
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
0
Andrey
Telerik team
answered on 17 Jul 2013, 06:31 AM
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 >>
Tags
Map
Asked by
Jacques
Top achievements
Rank 2
Answers by
Andrey
Telerik team
Zi
Top achievements
Rank 1
Share this question
or