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

simple object as shape datasource

3 Answers 67 Views
Map
This is a migrated thread and some comments may be shown as answers.
adi
Top achievements
Rank 1
adi asked on 03 Apr 2018, 01:12 PM

I have a simple object with some string properties ('name', 'Id', 'GeoJson'). I want to use this object as datasource in a map as shape layer. It's quite a bit ago I worked with Telerik. So, sorry for my stupid question.

Thanks

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 06 Apr 2018, 01:30 PM
Hello Adi,

Please review the Getting Started with Client-side Data Binding article where some examples are provided and check if that helps to resolve the issue. 

If not, please provide a sample of the object you are trying to bind the Map to so that we have a better understanding of your scenario and be able to provide more specific suggestions.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
adi
Top achievements
Rank 1
answered on 11 Apr 2018, 08:24 AM

I used the silverlight RadMap control in the past and want to switch to ASP.NET RadMap control. In Silverlight, I had an InformationLayer with a SqlGeospatialDataReader (see sample code). That works fine for Silverlight. In ASP.NET RadMap, I did not find

<telerik:InformationLayer x:Name="structureLayer">
  <telerik:InformationLayer.Reader>
    <telerik:SqlGeospatialDataReader x:Name="sqlReader" GeospatialPropertyName="Polygon" ReadCompleted="sqlReader_ReadCompleted" ToolTipFormat="{} {Abbreviation}">
       <telerik:SqlGeospatialDataReader.ToolTipTemplate>
          <DataTemplate>
            <StackPanel Margin="10,5">
              <TextBlock FontWeight="Bold" Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Abbreviation'}"></TextBlock>
              <TextBlock Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Name', StringFormat='NAME: {0:#,#.0}'}"></TextBlock>
              <TextBlock Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Id', StringFormat='ID: {0:#,#.0}'}"></TextBlock>
            </StackPanel>
          </DataTemplate>
        </telerik:SqlGeospatialDataReader.ToolTipTemplate>
      </telerik:SqlGeospatialDataReader>
    </telerik:InformationLayer.Reader>
    <telerik:InformationLayer.ShapeFill>
      <telerik:MapShapeFill Stroke="Crimson" StrokeThickness="1" >
        <telerik:MapShapeFill.Fill>
          <SolidColorBrush Color="Gainsboro" Opacity="0.4"/>
        </telerik:MapShapeFill.Fill>
      </telerik:MapShapeFill>
    </telerik:InformationLayer.ShapeFill>
</telerik:InformationLayer>

The Silverlight app gets the data from a webservice. The polygon source data looks like that and will be bind to sqlReader in the backend code of the Silverlight application. As I can read in the suggested article, the concept of ASP.NET RadMap data binding is a bit different.

[DataContract]
public class Structure
{
    private string _id;
    private string _name;
    private string _abbrevitation;
    private string _type;
    private string _geoJson;
 
 
    [DataMember]
    public string Id
    {
        get { return _id; }
        set { _id = value; }
    }
 
    [DataMember]
    public string Name
    {
        get { return _name; }
        set { _name = value; }
    }
 
    [DataMember]
    public string Abbrevitation
    {
        get { return _abbrevitation; }
        set { _abbrevitation = value; }
    }
 
    [DataMember]
    public string Type
    {
        get { return _type; }
        set { _type = value; }
    }
 
    [DataMember]
    public string GeoJSON // is a polygon
    {
        get { return _geoJson; }
        set { _geoJson = value; }
    }
 
}
0
Peter Milchev
Telerik team
answered on 16 Apr 2018, 12:12 PM
Hello Adi,

Yes, the Map for ASP.NET AJAX and the Map for Silverlight have very different implementation so it is expected to have some differences in the configuration and binding.
The Map for ASP.NET AJAX is a wrapper of the client-side Kendo UI Map widget so it is better to use the JSON received from the WebService directly. 

Here are some resources that should help you to bind the Map for ASP.NET AJAX: 
Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Map
Asked by
adi
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
adi
Top achievements
Rank 1
Share this question
or