Hi Guys
I am having some issues displaying a point layer. No matter what I try, the symbols for the layer are just tiny dots in the map. Additionally the hover over highlighting seems to be acting extremely odd. What happens is that when I move the mouse the point that is highlighted is usually no where near the cursor and some map elements are not able to be highlighted.
It seems that the map is creating large symbols for the points, these are overlapping each other, but the map is not drawing them. At least that is my guess. I have tried playing with SymbolSize and some other attributes but I just cant seem to get it right.
Im sure its something simple that I have just missed.
The Xaml Map definition is below
<igMap:XamMap x:Name="theMap" Initialized="theMap_Initialized" HorizontalAlignment="Left" GridDisplayMode="None" ElementClick="theMap_ElementClick" Background="{x:Null}" Foreground="{x:Null}" ViewportBorderBrush="{x:Null}" ViewportBackground="{x:Null}"> <igMap:MapLayer SymbolType="Bubble" DataContext="{Binding}" LayerName="DropLocations"> <igMap:MapLayer.Reader> <igMap:SqlShapeReader DataMapping="Data=Geom;Id=liEventKey;" /> </igMap:MapLayer.Reader> </igMap:MapLayer> </igMap:XamMap.Layers> <igMap:MapNavigationPane Margin="10" igControls:XamDock.Edge="InsideRight" /> </igMap:XamMap>
The data is being set as per below
ObservableCollection<vwLocationWithWKTGeom> geoms = ((LocationRepository)theMap.Layers["ROMPAD"].DataContext).FindAllSpatialLocations; SqlShapeReader sqlReader = theMap.Layers["ROMPAD"].Reader as SqlShapeReader; if (sqlReader != null) { sqlReader.DataSource = geoms; theMap.Layers["ROMPAD"].ImportAsync(); }
where the Geom column is a Well known text field a couple of examples below
POINT(40.8559 20.9835)
POINT(42.6019 -31.2075)
Ok that setting the point size after it is drawn fixed the problem.
I do seem to have to add the points to the polygon layer, If i tried 2 layers (one for points, one for polygons) then one of them doesnt show. This is probably just that i cant seem to set the background of the top layer to transparent.
This makes the code a little ugly as I have to maniulate the objects holding the polygons into the point object structure. so we can load them. If you could possibly give me an example (in xaml) of adding 2 layers without the first layer blottting out the second that would be great.
Thanks for the help so far
Graham
As a reply to my own post
if (e.Action == MapLayerImportAction.End) { foreach (MapElement s in (sender as MapLayer).Elements) { if (s != null) { if (s.GetType() == typeof(SymbolElement)) ((SymbolElement)s).SymbolSize = 10; } } }
is the correct code. Which does help with setting symbol size
Now just have to get them in the right place
In regards to setting of the points.
.Elements.OfType<SymbolElement())
in the release version of the map I get the errors
Error 1 'Infragistics.Controls.Maps.MapElementCollection' does not contain a definition for 'OfType' and no extension method 'OfType' accepting a first argument of type 'Infragistics.Controls.Maps.MapElementCollection' could be found (are you missing a using directive or an assembly reference?)
Are we using the same version?
I have not yet been able to replicate the mouseover issue you saw. But I may have to try the RTM version of the map, as the bug (if it is one) may have already been resolved in the build I am using.
Hi,
If you could provide a bit more info it will help us track down your problems. Is there a projection applied to the point data? If so, which one? Are you overlaying this point layer on another layer? Are the projections the same?
There's some info I can provide thusfar, and Vlad communicated to me a bit more info than in your post here, so I'll try to speak to that too.
The SymbolElements read from WKT currently default to size 1 and the SymbolSize of the layer doesn't propagate. This smells like a bug to me, so I'll get back to you with a bug number. In the meantime, you can set the SymbolSize for the points like this:
private void pointLayer_Imported( object sender, MapLayerImportEventArgs e) { if (e.Action == MapLayerImportAction.End) { foreach (SymbolElement s in (sender as MapLayer) .Elements.OfType<SymbolElement>()) { s.SymbolSize = 10; } } }
If I overlay the point data you sent Vlad on a world map, I get this:
Are these points in the right place based on that data (that you sent Vlad), if not it could be a case of the projection of that data not matching the projection of the rest of the map.
-Graham