Cannot display a Shape file

3 posts, 0 answers
  1. David Kucharski
    David Kucharski avatar
    50 posts
    Member since:
    Feb 2010

    Posted 05 Jul 2011 Link to this post

    <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. David Kucharski
    David Kucharski avatar
    50 posts
    Member since:
    Feb 2010

    Posted 06 Jul 2011 Link to this post

    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.
  3. DevCraft banner
  4. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 08 Jul 2011 Link to this post

    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!

Back to Top