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

RadMap shapefiles in .NET 5

4 Answers 22 Views
Map
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 12 Nov 2020, 01:06 PM

Hi there,

I am trying to make an offline world map using the RadMap control. I am using shapefiles (.shp and .dbf) such as done in the ShapefileMapShapeReader example in the SDK. However, this is done targeting .NET Framework v4.0, whereas I'd like to attempt this targeting .NET 5. What I did was: Update to the latest version of the Telerik UI for WPF, including the Visual Studio 2019 plugins. I made a new Telerik WPF application (targeting .NET 5) and copied the contents from the SDK example (the MainWindow.xaml contents and the world.shp and world.dbf files, set the latter two to have Build Action "Resource"). However, this does not display the map as it does in the example.

Now I tried the exact same steps as described above, but now for a Telerik WPF application targeting .NET Framework v4.0 (and hence making my own ShapefileMapShapeReader example). This does work properly. Can you give me any pointers on if you experience the same and if there are possibilities to fix this issue? Or, if you're reading this and have a better idea about showing offline coastal lines in the RadMap control, I'm open to that too. :-)

Kind regards,

Tom

See http://www.tomjoosten.nl/TelerikWpfMap.zip

4 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 17 Nov 2020, 10:17 AM

Hello Tom,

Thank you for the shared details. 

I was not able to download the shared project, since my browser was tagging it as dangerous, however I followed the listed steps and I was able to reproduce the described result on my end. I have logged the scenario in our feedback portal, where you can track its status: Map: Shape files (.shp) are not displayed correctly in .NET CORE 3.1 and .NET 5. I have also added some telerik points to your account as a small thank you for sharing this with us. 

I am afraid that for the time being, I cannot suggest a workaround, except using the full .NET Framework version of the dlls. I do apologize for any inconvenience caused. 

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Tom
Top achievements
Rank 1
answered on 17 Nov 2020, 10:35 AM

Hello Vladimir,

For anyone experiencing these issues in their application: the workaround I found was having a ShapeFileReader in the code-behind and looping through all the elements. It does, however, not use the DataSource and Source properties of the MapShapeReader.

StreamResourceInfo shapeResourceInfo = Application.GetResourceStream(new Uri("/Maps/world.shp", UriKind.RelativeOrAbsolute));

var sfr = ShapeFileReader.Read(shapeResourceInfo.Stream);
foreach (var shape in sfr)
{
    myLayer.Items.Add(shape);
}

Kind regards,

Tom

 

0
Vladimir Stoyanov
Telerik team
answered on 20 Nov 2020, 07:59 AM

Hello Tom,

I am glad to hear that you were able to achieve the desired result. Thank you for sharing your approach.

On a side note, there are 2 visualization engines in the RadMap package. The old implementation of the map objects' (points and shapes) visualization consists of 3 layers: InformationLayer, DynamicLayer and VirtualizationLayer. This visualization engine, however, lacks certain features and has a few performance issues.

You can try out the new visualization engine in the RadMap - VisualizationLayer. It was designed from scratch to have better performance.

Hope this helps.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Vladimir Stoyanov
Telerik team
answered on 30 Nov 2020, 03:58 PM

Hello Tom,

I am following up to let you know that I was wrong in my initial assessment of the scenario. Please, excuse me for misleading you on that. The desired functionality works as intended in .NetCore 3.1 and .Net 5. 

I am attaching a sample project that shows the ShapefileMapShapeReader SDK example converted to .Net 5. I will also proceed with closing the feedback item referenced earlier. 

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Map
Asked by
Tom
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Tom
Top achievements
Rank 1
Share this question
or