Non .DBF Files in HeatMap and shapefiles or empty provider

2 posts, 0 answers
  1. Eyad Harb
    Eyad Harb avatar
    2 posts
    Member since:
    Jun 2010

    Posted 18 Dec 2010 Link to this post

    Dear All,
                    I have seen the RadMap Heatmap Demo and was wondering is there a way to use other data sources for the empty provider or shape file, say data from sql server or a list for that matter please assist at your soonest. Please look at this froma sharepoint 2010 point of view where we are developing a heatmap webpart.
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 20 Dec 2010 Link to this post

    Hello Chafik Moalem,

    First of all, I cannot recommend you to use a non DBF data source only.

    The ESRI shapefile(*.shp) does not contain any information about the shape e.g. when you load shapefile for the USA states, you do not know what state has been loaded. So I would recommend you to use a DBF file with at least a field which can be used as a primary key to obtain information from non DBF data source.

    You can assign the property set for extended data with DBF fields and also additional fields before the data has been read. You can assign values to additional fields from code for each read shape using the PreviewReadCompleted event.

    The sample code is below:
    private bool initialized;  
    private const string NonDbfDataField = "SampleDataField";  
    void RadMap1_InitializeCompleted(object sender, EventArgs e)  
        if (!this.initialized)  
            this.initialized = true;  
            this.StateLayer.Reader = new MapShapeReader();  
            // create the ExtendedPropertySet with DBF and non DBF data fields  
            ExtendedPropertySet propertySet = new ExtendedPropertySet();  
            propertySet.RegisterProperty("STATE_NAME", string.Empty, typeof(string), string.Empty);  
            propertySet.RegisterProperty(NonDbfDataField, string.Empty, typeof(string), string.Empty);  
            this.StateLayer.Reader.ExtendedPropertySet = propertySet;  
            this.StateLayer.Reader.PreviewReadCompleted += new PreviewReadShapesCompletedEventHandler(Reader_PreviewReadCompleted);  
            this.StateLayer.Reader.Source = new Uri(string.Format(ShapeRelativeUriFormat, "usa_states.shp"), UriKind.Relative);  
            this.StateLayer.Reader.DataSource = new Uri(string.Format(ShapeRelativeUriFormat, "usa_states.dbf"), UriKind.Relative);  
    private void Reader_PreviewReadCompleted(object sender, PreviewReadShapesCompletedEventArgs eventArgs)  
        if (eventArgs.Error == null)  
            foreach (MapShape shape in eventArgs.Items)  
    private void SetAdditionalData(MapShape shape)  
        ExtendedData extendedData = shape.ExtendedData;  
        if (extendedData != null)  
            string stateName = (string)shape.ExtendedData.GetValue("STATE_NAME");  
            string additionalFieldValue = this.GetDataByStateName(stateName);  
            // assign value to non DBF property   
            shape.ExtendedData.SetValue(NonDbfDataField, additionalFieldValue);  
    private string GetDataByStateName(string stateName)  
        // returns additional fields data  

    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft R3 2016 release webinar banner
Back to Top