Apr 7, 2010 at 3:41 PM

Hi. First tanks for the Bing Maps Toolkit a live saver!

I am using the GisSharpBlog.NetTopologySuite.IO.WKBReader in my quest to render geography from Sql server 2008, and it works great and really fast, so my problem is when my geo has holes in them they don’t render correctly is there code that I am missing to support this functionality or is it a limitation of the  WKBReader

The code I used is the same as in the documentaition getting my data from a WCF service


private void layerPanel_LoadLayer(object sender, LoadLayerEventArgs args, Action<ObservableCollection<VectorLayerData>, LayerDefinition> callback)
var data = new ObservableCollection<VectorLayerData>();
GisSharpBlog.NetTopologySuite.IO.WKBReader f = new GisSharpBlog.NetTopologySuite.IO.WKBReader();
       foreach (var feature in Features)
              data.Add(new VectorLayerData
                     Geo = f.Read(feature).AsBinary(),
                     ID = (new Guid()).ToString(),
                     Label = “Test”,
                     Style = “defaultstyle”
      callback(data, args.Layer);


from WCF
        private List<byte[]> DataSetToByte(DataSet data)
            List<byte[]> dataBytes = new List<byte[]>();
            if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
                int counter = 0;
                foreach (DataRow row in data.Tables[0].Rows)
                    SqlGeography geometry = row["geom"] != DBNull.Value ? (SqlGeography)row["geom"] : null;

                    counter += 1;

            return dataBytes;

Apr 8, 2010 at 1:02 AM

You are doing everything correctly, we havn't yet added support for holes.

In the MapGeometry Project, class BaseGeometry:

       protected EnhancedMapPolygon createPolygon(IGeometry polygon, MapLayerBase layer)
            //TODO: add support for holes. For now we will use outer ring only.
            var outer = polygon.Boundary.GetGeometryN(0).Coordinates;
            var poly = new EnhancedMapPolygon
                               Locations = CoordinateConvertor.CoordinatesToLocationCollection(outer),
                               GeometryStyle = StyleSpecification,
                               Visibility = Visibility
            layer.AddChild(poly, CoordinateConvertor.ConvertBack(polygon.Centroid.Coordinate));
            return poly;

Our enhanced Map polygon is still using the core mappolygon object from the Microsoft control, it doesn't support holes. We have a few options, Ricky has been playing with this generically:!E7DBA9A4BFD458C5!1100.entry

We need to add this support.