Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Use existing shapes file and populate ExtendedData dynamically

$
0
0

 I've been using samples from the SDK along with this post   http://www.telerik.com/forums/accessing-the-dbf-file  but have failed to do what I'm hoping should be simple ;-)

 I need to show a map of the U.S. with the states as shapes, color coded to a value that I set dynamically.   E.g. population, average income, total number of hospital beds, etc.  The values (1 for each state) are provided by my underlying model based on user selections on the screen.    E.g.  User sees a combo box listing the various variables to map, picks one, and the map colors the states based on 1 value per state.  

 Looking at the examples, it seems I need 2 files .. 

  • A "shp" file that contains the actual shape definition.  I downloaded U.S. state shape file from http://www.arcgis.com/home/item.html?id=f7f805eb65eb4ab787a0a3e1116ca7e5
  • A "dbf" file that contains some data that is magically keyed to the items in the shp file. The corresponding dbf file from the above site has only basic data such as Name, FIPS code, etc. 

Since the values that will drive the color of the shapes can only be determines at run-time, I'd like to just have a call-back, or some method, to provide a value to each of the 50 state shapes.   

I thought the Telerik Forum's post (above)  above link would solve my problem, but I get a compile error on a couple lines, and I'm wondering if this is a Silverlight vs WPF issue, or a version issue or a simple case of user error.  on the following 2 statements.  this.informationLayer.Reader does not have a "Source" or a "DataSource" property.   (also please see attached screenshot) 

this.informationLayer.Reader.Source = new Uri(string.Format(ShapeRelativeUriFormat, "world.shp"), UriKind.Relative);
this.informationLayer.Reader.DataSource = new Uri(string.Format(ShapeRelativeUriFormat, "world.dbf"), UriKind.Relative);

My Xaml is pasted below.   I've tried to  attached the project files in a zip file, but it is over 2Meg.  It is actually the sample from the SDK browser with a few lines of code as suggested by the forum link above.... 

Thanks for your advice. 

 

<Windowx:Class="InformationLayerColorizerModeCount.MainWindow"
        Title="MainWindow"Height="800"Width="1200">
    <Grid>
        <telerik:RadMapx:Name="radMap"InitializeCompleted="radMap_InitializeCompleted">
            <telerik:RadMap.Provider>
                <telerik:EmptyProvider/>
            </telerik:RadMap.Provider>
            <telerik:InformationLayerx:Name="informationLayer">
                <telerik:InformationLayer.Reader>
                    <telerik:MapShapeReaderDataSource="/InformationLayerColorizerModeCount;component/Resources/world.dbf"
                                            Source="/InformationLayerColorizerModeCount;component/Resources/world.shp"/>
                </telerik:InformationLayer.Reader>
                <telerik:InformationLayer.Colorizer>
                    <telerik:ColorMeasureScaleExtendedPropertyName="SQKM"Mode="Count"TickMarkCount="7">
                        <telerik:ColorMeasureScale.ShapeFillCollection>
                            <telerik:MapShapeFillFill="#FFFAB935"Stroke="White"StrokeThickness="2"/>
                            <telerik:MapShapeFillFill="#FFC9441C"Stroke="White"StrokeThickness="2"/>
                        </telerik:ColorMeasureScale.ShapeFillCollection>
                    </telerik:ColorMeasureScale>
                </telerik:InformationLayer.Colorizer>
            </telerik:InformationLayer>
        </telerik:RadMap>
    </Grid>
</Window>

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>