<
telerik:RadMap
x:Name
=
"radMap"
>
<
telerik:InformationLayer
x:Name
=
"informationLayer"
>
<
telerik:InformationLayer.Reader
>
<
telerik:MapShapeReader
DataSource
=
"/Silverlight.Help.RadMapSamples;component/Data/world.dbf"
Source
=
"/Silverlight.Help.RadMapSamples;component/Data/world.shp"
/>
</
telerik:InformationLayer.Reader
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
Is there a working example somewhere showing how to read ESRI shape data with RadMap?
Thanks,
Ed Graham
12 Answers, 1 is accepted
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.
I have attached a sample solution which reads two shape-files. The world_continents file is read from resources. And the europe shape-file is read from a web site. Note that the build action for these files are different: Resourse for the world_continents and Content for the europe shape-files.
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!
.jpg)
Hello, I'm trying to use the ESRIShapeFile example and use it as a simple "test" to see if it can read my shape file.
I cannot see the preview of the map and it will not show in the Silverlight application. (RadMap for SilverLight VS 2010, Telerik 2011 Q2)
I changed the file name and updated the Resourse for the "world_continents" to NH_LOTS
The shape files were exported from ArcGIS 9 as NH_LOTS.DBF, NH_LOTS.shp (there's a shx file, but its not used.)
------------------------------
I have tried:
The preview screen will not refresh and the PreviewReadCompleted="MapShapeReader_PreviewReadCompleted" does not show an exception
I have tried the following with the MapShapeReader CoordinateConverter="EPSG900913Converter" & CoordinateConverter="EPSG900913Converter"
--------------------------
I have tried parts of the following:
http://www.telerik.com/help/silverlight/radmap-features-shapefiles-support.html
I have tried the following c# code below: The count of the "shapes" is correct, but it appears that "shape" is null.
StreamResourceInfo shapeResourceInfo = Application.GetResourceStream( new Uri( "/Silverlight.Help.RadMapSamples;component/Data/world.shp", UriKind.RelativeOrAbsolute ) );
StreamResourceInfo dbfResourceInfo = Application.GetResourceStream( new Uri( "/Silverlight.Help.RadMapSamples;component/Data/world.dbf", UriKind.RelativeOrAbsolute ) );
List<FrameworkElement> shapes = ShapeFileReader.Read( shapeResourceInfo.Stream, dbfResourceInfo.Stream );
foreach ( var shape in shapes )
{
this.informationLayer.Items.Add( shape );//This causes a null exception
}
------------------------------------------------------------------------------------------------------------------------------------
<UserControl x:Class="ESRIShapeFile.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadMap x:Name="radMap">
<telerik:RadMap.Provider>
<telerik:EmptyProvider />
</telerik:RadMap.Provider>
<telerik:DynamicLayer x:Name="worldLayer">
<telerik:DynamicLayer.Reader>
<telerik:MapShapeReader DataSource="/ESRIShapeFile;component/NH_Lots.DBF"
Source="/ESRIShapeFile;component/NH_Lots.shp"
PreviewReadCompleted="MapShapeReader_PreviewReadCompleted"
/>
</telerik:DynamicLayer.Reader>
</telerik:DynamicLayer>
</telerik:RadMap>
</Grid>
</UserControl>
Unfortunately we can't reproduce the problem using just the code snippet you sent. I have changed the ESRIShapeFile example for using of the ShapeFileReader.Read method and it works without problems.
There could be a different problem related to the projection of shapes in the shape file. Currently Geospatial data can be represented using the following projections which are supported by the map control:
- The Mercator projection EPSG:4326 (default) that refers to WGS84 as (latitude, longitude) pair coordinates in degrees
- The OSGB-1936 projection which also known as EPSG:27700
- The EPSG:900913 projection which also known as EPSG:3857 and Pseudo-Mercator projection that refers to WGS84 as (latitude, longitude) pair coordinates in meters
The shape file you use should be saved using one of projections above. Usually the .prj file contains information about the projection of shape files. We need at least your shape file to reproduce the problem.
Could you please create new support ticket and attach your shape file or a small sample solution which reproduces the problem?
Best wishes,
Andrey Murzov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Could you please create a new support ticket and attach your shape file or a small sample solution which reproduces the problem?
Regards,
Andrey Murzov
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Please double check the file to the path is correct and you have set its BuildAction to "Resource". You can also open a new support thread with an isolation we can look at if these suggestions do not help.
Regards,
Petar Mladenov
Telerik


Please check out the attached project and compare it to yours. Also double check the Build Action - right click on the dbf and shp files, properties and see the Build Action. Double check the assembly name of the Silverlight project is "CollMap" (right click on the Silverlight project) and Properties => AssemblyName in Silverlight Tab.
Regards,
Petar Mladenov
Telerik by Progress
