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

Reading Shape files in RadMap

4 Answers 214 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 25 Oct 2010, 02:15 PM
Hi,
 I have downloaded the beta version of the WPF RadMap specifically to look at the shape file importing.
I have used your examples to render your example .shp files

ThematicLayer.Reader =

 

new MapShapeReader();

 

ThematicLayer.Reader.ReadCompleted += MapShapeReader_ReadCompleted;

ThematicLayer.Reader.Source =

 

new Uri(string.Format(ShapeFilePath, new object[] { layerName, ShapeExtension }), UriKind.Absolute);

 

ThematicLayer.Reader.DataSource =

 

new Uri(string.Format(ShapeFilePath, new object[] { layerName, DbfExtension }), UriKind.Absolute);

 

ThematicLayer.Reader.SourceType =

 

ShapeSourceType.ShapeFile;

 


this works fine, but when I use some shape files that I have bought I get an error when the shapes are drawn on the canvas

  Message=Width and Height must be non-negative.
  Source=WindowsBase
  StackTrace:
       at System.Windows.Size..ctor(Double width, Double height)
       at Telerik.Windows.Controls.Map.MapCanvas.SetItemPosition(MapCanvasItem item, Point point) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q3\Sources\Development\Controls\DataVisualization\Map\Layers\MapCanvas.cs:line 371
       at Telerik.Windows.Controls.Map.MapCanvas.ArrangeItem(MapCanvasItem item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q3\Sources\Development\Controls\DataVisualization\Map\Layers\MapCanvas.cs:line 696
       at Telerik.Windows.Controls.Map.MapCanvas.ArrangeOverride(Size finalSize) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q3\Sources\Development\Controls\DataVisualization\Map\Layers\MapCanvas.cs:line 387
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
       at System.Windows.UIElement.Arrange(Rect finalRect)
       at System.Windows.ContextLayoutManager.UpdateLayout()

If I load my shape files into MapWindowGIS, they require 3 files, the .shp, the .dbf and the .shx.  I can't see where to specify the location of the .shx file in the MapShapeReader?

Am I missing something?

Thanks
Simon

4 Answers, 1 is accepted

Sort by
0
Simon
Top achievements
Rank 1
answered on 25 Oct 2010, 05:44 PM
I have some examples of shp files that do not load.  I can't attach them to this post, but I can email them if you need some that fail.
Alternatively, you can download a sample from this website

http://www.geoplan.com/Mapping_Solutions/GIS_Mapping_Data/Postcode_Sector_Boundaries

Thanks
Simon
0
Accepted
Andrey
Telerik team
answered on 27 Oct 2010, 09:15 AM
Hi Simon,

Thank you for the feedback.
I have downloaded the shape files using a link you sent. In fact these files use the Ordnance Survey coordinate system (http://en.wikipedia.org/wiki/Ordnance_Survey_National_Grid), but the RadMap supports WGS 1984 only.
The shape file doesn't contain information about coordinate system it uses.
Unfortunately our control doesn't support translating between different coordinate systems and it does not seem to be a trivial feature to implement.

We have created the PITS issue to support this feature in future releases. You can track its implementation using the following link:
http://www.telerik.com/support/pits.aspx#/public/silverlight/3827

Best wishes,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Simon
Top achievements
Rank 1
answered on 27 Oct 2010, 01:46 PM
Andrey,

Thanks for this.  Indeed the file is OSGB 1936 format.  I have used MapWindow to reproject the shp file to WGS 1984.  I don't know whether this has actually worked as I still get the same error.

In the meantime I have contacted GeoPlan who supplied the data to see if they can resupply as WGS 1984 or give me a suitable conversion program.

Will keep you informed on my progress

Thanks
Simon
0
Simon
Top achievements
Rank 1
answered on 27 Oct 2010, 04:07 PM
Managed to convert my files using ogr2ogr

ogr2ogr -t_srs WGS84 -s_srs EPSG:27700 destination.shp source.shp

where WGS84 is the target coordinate system, and EPSG:27700 is the source coordinate system (OSGB36)

Thanks for you help on this again

Regards
Simon
Tags
General Discussions
Asked by
Simon
Top achievements
Rank 1
Answers by
Simon
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or