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

Shape SQL Map data

4 Answers 133 Views
Map
This is a migrated thread and some comments may be shown as answers.
Luke
Top achievements
Rank 1
Luke asked on 20 Apr 2015, 11:54 AM

Recently I encountered this article;

 

http://www.sqlservercentral.com/articles/Reporting+Services+(SSRS)/124307/

 

Which was a great little article showing me a much better way of storing the map data (SQL - rather than as a shape file).  Using it in the standard Microsoft Report Builder is a breeze.

 

Ha! I thought, with my recent (and slowly getting better) understanding of the map control, and SqlGeospatialDataReader, I though I could master that data and use it for all my map needs.  Problem is I cannot get to grips at all with using that Map data in a dataset and implementing it the map control.  The documentation offered at http://docs.telerik.com/devtools/silverlight/controls/radmap/features/information-layer/sql-geospatial-data certainly makes reference to what I assume is what I am after (it makes specific reference to dataset data sources), but I cannot envisage where to begin, as the documentation is not so specific about the dataset element.

 

Any advice/direction is much appreciated, thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 22 Apr 2015, 02:04 PM
Hello Luke,

Generally both the InformationLayers'  SQLGeoSpatialDataReader and the VisualizationLayer's  AsyncSqlGeospatialDataReader have two main properties - Source and GeoSpatialPropertyName.

Source should be used to references a collection of objects which store SQL Geospational Data in WKT / WKB format in one of its properties or in one of its Columns (if the object is System.Data.DataRow). The GeoSpatialProeprtyName specifies the Name of the property (usually a string property) which holds the geometry data. In the documentation you read the example shows this approach with binding to database. You can also find simpler example in our online demos - Map WKT Reader Demo. In it the SQLReader Source is bound to collection of business objects which are *hardcoded* in the ViewModel:
public class WktDataViewModel
{
    private Collection<WktDataRow> _wktDataCollection;
 
    public WktDataViewModel()
    {
        this.WktDataCollection = new Collection<WktDataRow>();
 
        WktDataRow northAreaDataRow = new WktDataRow();
        northAreaDataRow.Name = "North Area";
        northAreaDataRow.Geometry = "Polygon (("
                + "-84.3932461670301, 33.7967217961125"
                + ", -84.418995373573 33.808989109452"
                + ", -84.4303250244518 33.8377961143588"
                + ", -84.4303250244518 33.8480616114576"

I hope this sample will help you in the getting started process. If any questions arise please do not hesitate to ask further.

Regards,
Petar Mladenov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Luke
Top achievements
Rank 1
answered on 22 Apr 2015, 08:16 PM

Hi and many thanks for the response

 

I am new to WPF, and I should also add that I am using VB.net (2012).  I understand what you mention above, and implemented the attached in VB.net - keeping all namespaces etc, but it keeps coming up with the same error in that 'WktDataViewModel' does not exist in the namespace;

The name "WktDataViewModel" does not exist in the namespace "clr-namespace:SQLGeospatialData"
 

I am not sure if I have ventured into a principle VB/WPF issue, or still floundering with the map, but any advice?

 

thanks

 

Luke

 

0
Accepted
Petar Mladenov
Telerik team
answered on 24 Apr 2015, 11:12 AM
Hi Luke,

When adding the class "WktDataViewModel" in the application please first build it in order to check that no errors exist in the class. The double check the namespace of the class to match the alias used in XAML.
For example in our online sample in XAML *example* alias stands for:
xmlns:example="clr-namespace:Telerik.Windows.Examples.Map.WktReader"
and the ViewModel is defined in the same namespace:
namespace Telerik.Windows.Examples.Map.WktReader
{
    public class WktDataViewModel

Simply check the solution for any errors in the files and corrrect matches between aliases, namespaces and classes.



Regards,
Petar Mladenov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Luke
Top achievements
Rank 1
answered on 26 Apr 2015, 12:15 PM
Thanks - sorted it
Tags
Map
Asked by
Luke
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Luke
Top achievements
Rank 1
Share this question
or