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

Cannot display a Shape file

2 Answers 79 Views
Map
This is a migrated thread and some comments may be shown as answers.
David Kucharski
Top achievements
Rank 1
David Kucharski asked on 05 Jul 2011, 04:41 PM
<telerik:RadMap x:Name="RadMap1" Background="{x:Null}">
                <telerik:InformationLayer x:Name="informationLayer">
                    <telerik:InformationLayer.Reader>
                        <telerik:MapShapeReader DataSource="SilverlightApplication4;component/Data/usa_states.dbf"
                                   Source="SilverlightApplication4;component/Data/usa_states.shp" />
                    </telerik:InformationLayer.Reader>
                </telerik:InformationLayer>
  
            </telerik:RadMap>
Hello,

I am very new to the RadMap and Silverlight architecture. I have the above code in my MainPage.axml page inside my SilverlightApplication4 project. Inside the same project I have a folder named Data that has 2 files. The usa_states.dbf and usa_states.shp files that came with the Telerik/Silverlight demos. When I run this application I receive no errors, but my RadMap control comes up dark gray with no states. The attached file is a print screen of my application. What am I doing wrong? Thanks,

FYI, I have tried the following combinations and still nothing:
SilverlightApplication4;component/Data/usa_states.dbf

/SilverlightApplication4/Data/usa_states.dbf
/SilverlightApplication4;component/Data/usa_states.dbf

2 Answers, 1 is accepted

Sort by
0
David Kucharski
Top achievements
Rank 1
answered on 06 Jul 2011, 05:37 PM
Looks like I was missing the following statements:

<telerik:RadMap.Provider>
    <telerik:EmptyProvider />
</telerik:RadMap.Provider>

Once I did that the usa_states shape file displayed. Now my next question, my demographic team create a zip code shape file using ESRI tools for me. When I tried the same code that displayed the usa_states file, my ESRI shape file did not show. There were about 33,000 records in the file.

I don't know if something is wrong with the file or I coded something wrong. How can I tell?

Thanks again.
0
Andrey
Telerik team
answered on 08 Jul 2011, 08:23 AM
Hello David Kurcharski,

You should specify the RadMap.Provider property. If you specify it in your XAML code, then a shape file will be displayed already in design time.
When you use shape files as resources then you should set the Uri format like to the following:
/Assembly Name;component/Path/File Name.
Also you can use the PreviewReadCompleted event to check errors which can occur during reading. When an error occurs then the Error property of PreviewReadShapesCompletedEventArgs contains the exception.
The sample code is below.
<telerik:RadMap x:Name="RadMap1">
    <telerik:RadMap.Provider>
        <telerik:EmptyProvider />
    </telerik:RadMap.Provider>
    <telerik:InformationLayer x:Name="informationLayer">
        <telerik:InformationLayer.Reader>
            <telerik:MapShapeReader
DataSource="/SilverlightApplication4;component/Data/usa_states.dbf"
Source="/SilverlightApplication4;component/Data/usa_states.shp"
PreviewReadCompleted="MapShapeReader_PreviewReadCompleted" />
        </telerik:InformationLayer.Reader>
    </telerik:InformationLayer>
</telerik:RadMap>

All the best,
Andrey Murzov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

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