This project is read-only.

How can SilverSpatial GeoLineString be used to populate Silverlight MapPolyline?

Jul 26, 2010 at 10:48 PM

I guess this would work:

            GeoLineString mp = (GeoLineString)SilverSpatial.Geometry.Parse("MULTIPOINT(0 2, 20 25, 60 30)");
            LocationCollection points = new LocationCollection();
            foreach (GeoPoint p in mp)
                Location location;
                if (myMap.TryViewportPointToLocation(new Point(p.Latitude,p.Longitude),out location))
            MapPolyline shape = new MapPolyline();
            shape.Locations = points;
            shape.StrokeThickness = 3;
            shape.Stroke = new SolidColorBrush(Color.FromArgb(255,0,0,0));

But there should be a cleaner way...

Aug 1, 2010 at 4:25 PM

Thanks for the suggestion. I have thought about this very issue in my own use of the library.

I thought about writing a assembly of extension methods and/or IValueConverters that would perform the conversions to and from the Bing Maps Silverlight Types. The reason it would be a separate assembly is so that the "core" SilverSpatial assembly will not need to have a reference added for the Bing Maps Silverlight assembly, since SilverSpatial is meant to be map platform/api agnostic. Also, separate assemblies of extension methods could easily be added to support additional Silverlight GIS libraries in the future; like DeepEarth.

I added this to the Issue Tracker. Go vote it up if you are interested in this.

Aug 8, 2010 at 10:43 AM

I noticed you've already started to work on it, i'll check it out asap