Hi, we are testing the silverlight data visualization product, we can add a polygon layer, but if we put a points layer over the polygon layer, the points do not appear on the map, only the polygons, we have added another polygon layer and after the point layer, we can see the 2 polygon layers, polyline layers, but no point layers, how can we solve this?
Hi losoriomx,
I have created a development issue #61272 that should be resolved in the next service release. In the meantime you can apply the following workaround: Try to set points' symbol type:
Attach to the MapLayer(the layer that show points) "Imported" event.
private void MapLayer_Imported(object sender, Infragistics.Controls.Maps.MapLayerImportEventArgs e){ if (e.Action == MapLayerImportAction.End) { var layer = (MapLayer)sender;
foreach (var element in layer.Elements) { var point = element as SymbolElement;
if (point != null) { point.SymbolType = MapSymbolType.Bubble; } } }}
Please let me know if it works for you.
Regards, Ivan Kotev
Private Sub MapLayer_Imported(ByVal sender As Object, ByVal e As Infragistics.Controls.Maps.MapLayerImportEventArgs) Handles Cabeceras.Imported If e.Action = MapLayerImportAction.End Then Dim layer = DirectCast(sender, MapLayer) For Each element In layer.Elements Dim point = TryCast(element, SymbolElement) If point IsNot Nothing Then point.SymbolType = MapSymbolType.Diamond End If Next End IfEnd Sub
Can you confirm that this line "point.SymbolType = MapSymbolType.Diamond" is executed i.e. there are some points read from the Shapefile ? If it is, could you provide some sample code and the points layer ?
We can make the points draws with the function, but now we have another problem, every time we run the proyect we get this error
Error: Unhandled Error in Silverlight Application Code: 4009 Category: ManagedRuntimeError Message: El elemento ya es un objeto secundario de otro elemento.
The element is a secondary object of another element, and no more refrences about to what object are the error message talking about
This is a general exception thrown by .NET when something somewhere goes wrong, the sad thing is that It could by anything. Could you provide the XAML and codebehind so we can investigate this issue ?
Hi losoriomx
Thanks for posting the shapefiles.
I have found 2 issues:
- for the "municipios" shapefile - with ShapeFileReader's DataMapping you are trying to set MapElement's Value property to value from NOMBRE column, but this property accepts double values and NOMBRE column contains strings. I guess you want to show values from NOMBRE as a captions for each element ? If this is the case set DataMapping like this: DataMapping="ToolTip=NOMBRE; Caption=NOMBRE"
- for the cabeceras shapefile - there is some issue with one of the points with SHAPE_ID 50, it seems that it's coordinates are not set:
Skipping this row I've been able to get the following result:
Regards,
Ivan Kotev
Of course, here are the shapefiles
Thanks for posting the code, I have tested it with 2 of our shapefiles and it's working fine. I guess there is some issue with the shapefiles you are using. Can you open them in some Shapefile Viewer ? Also if you don't provide a Coordinate system and projection for the shape file reader it will assume that points are in geodetic coordinates. Could you attach the shapefiles ?
Here is the XAML
<UserControl x:Class="silvmapas.MainPage" xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="900" xmlns:ig="http://schemas.infragistics.com/xaml"> <Grid x:Name="LayoutRoot" Background="White"> <ig:XamMap HorizontalAlignment="Left" Margin="10,10,0,0" Name="XamMap1" VerticalAlignment="Top" Width="880" Height="580" MapProjectionType="Equirectangular"> <ig:XamMap.Layers> <ig:MapLayer x:Name="Division"> <ig:MapLayer.Reader> <ig:ShapeFileReader Uri="ShapeFiles/municipios" DataMapping="ToolTip=NOMBRE; Value=NOMBRE"/> </ig:MapLayer.Reader> </ig:MapLayer> <ig:MapLayer x:Name="cabeceras" Imported="MapLayer_Imported"> <ig:MapLayer.Reader> <ig:ShapeFileReader Uri="ShapeFiles/cabeceras"/> </ig:MapLayer.Reader> </ig:MapLayer> </ig:XamMap.Layers> <ig:MapNavigationPane HorizontalAlignment="Left" /> </ig:XamMap> </Grid></UserControl>
And here is the code behind
Imports Infragistics.Controls.MapsPartial Public Class MainPage Inherits UserControl Public Sub New() InitializeComponent() End Sub Private Sub MapLayer_Imported(ByVal sender As Object, ByVal e As Infragistics.Controls.Maps.MapLayerImportEventArgs) If e.Action = MapLayerImportAction.End Then Dim layer = DirectCast(sender, MapLayer) For Each element In layer.Elements Dim point = TryCast(element, SymbolElement) If point IsNot Nothing Then point.SymbolType = MapSymbolType.Bubble point.SymbolSize = 4 End If Next End If End SubEnd Class
Imports Infragistics.Controls.MapsPartial Public Class MainPage Inherits UserControl Public Sub New() InitializeComponent() End Sub
Private Sub MapLayer_Imported(ByVal sender As Object, ByVal e As Infragistics.Controls.Maps.MapLayerImportEventArgs) If e.Action = MapLayerImportAction.End Then Dim layer = DirectCast(sender, MapLayer) For Each element In layer.Elements Dim point = TryCast(element, SymbolElement) If point IsNot Nothing Then point.SymbolType = MapSymbolType.Bubble point.SymbolSize = 4 End If Next End If End SubEnd Class