I have an issue with data mapping between my shapfile and the layer. The values of the shapefile elements dont get set. If the set the value of a single emelent directly in code behind it works fine.
Could you help me out and tell me what I'm doing wrong.
<igMap:XamWebMap x:Name="floorMap" WindowZoomMinimum=".1" WindowZoomMaximum="5" Background="{x:Null}" ViewportBackground="{x:Null}" ViewportBorderBrush="{x:Null}" GridDisplayMode="None" WindowAnimationMode="None" WindowScale="0.85" Canvas.Left="8" Canvas.Top="8" Margin="8,139,8,156" ElementClick="floorMap_ElementClick"> <igMap:XamWebMap.Layers> <igMap:MapLayer Name="statesLayer" FillMode="Chloropleth" DataMapping="Name=slotnumber; Value=TotalCashIn;" ToolTip="Total Cash In: {Value}" Stroke="{x:Null}" StrokeThickness="0" Foreground="#FFFF0000" ShadowFill="{x:Null}" Cursor="Hand"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader DataMapping="Name=ID; Caption=ID;" Uri="ShapeFiles/DemoFloor"/> </igMap:MapLayer.Reader> <igMap:MapLayer.ValueScale> <igMap:LinearScale IsAutoRange="True" MaximumValue="1500" MinimumValue="0" /> </igMap:MapLayer.ValueScale> </igMap:MapLayer> </igMap:XamWebMap.Layers> <igMap:MapNavigationPane Margin="10" igMap:XamWebDock.Edge="InsideRight" /> <igMap:MapColorSwatchPane Width="300" Height="50" Margin="0, 10, 0, 0" igMap:XamWebDock.Edge="InsideTop" LayerName="statesLayer"></igMap:MapColorSwatchPane> <igMap:MapThumbnailPane Width="200" Height="100" HorizontalAlignment="Center" Margin="0,0,0,10" Background="Transparent" igMap:XamWebDock.Edge="InsideBottom" Style="{StaticResource MapThumbnailStyle}" /> </igMap:XamWebMap>
private
void refreshMap()
{
MSAGV1.FeedService1.
SlotTransactionServiceClient webService = new MSAGV1.FeedService1.SlotTransactionServiceClient();
webService.GetSlotsByIntervalandDatesSPCompleted +=
new EventHandler<GetSlotsByIntervalandDatesSPCompletedEventArgs
>(webService_GetSlotsByIntervalandDatesSPCompleted);
webService.GetSlotsByIntervalandDatesSPAsync();
}
void webService_GetSlotsByIntervalandDatesSPCompleted(object sender, GetSlotsByIntervalandDatesSPCompletedEventArgs e)
this.floorMap.Layers["statesLayer"].DataSource = e.Result;
it looks fine to me as long as:
is all this true?
take a look at the "world data - gross domestic product" sample for a demonstration of the layer + shapefilereader datamapping.
I spit out in a listbox all the slotnumber and TotalCashIn values just to make sure I'm getting all the data properly.
I also programatically assign the values to the shapes. (Which does take a very long time for 2000 values)
for
(int i = 0; i < e.Result.Count; i++){
var elems = this.floorMap.Layers["statesLayer"].Elements.FindElement("Name", e.Result[i].slotnumber.ToString());
elems.First().Value =
Convert.ToDouble(e.Result[i].TotalCashIn);
Thanks in advance for your help.
if you could provide a sample project which reproduces the problem, i think we could definitely help find what's wrong.
for the moment i'm still just guessing...
is slotnumber an actual property or is it just a field? in other words, does it have a getter and setter?
It works! I tried it with a much smaller shapefile element set. I go back and try it with 2000+ elements later and post my findings in terms of the amount of time taken to render.
Thanks for your help.