WP-render vector layer issue

Jan 9, 2011 at 7:08 AM

hi paul.

Mapsui is a great proj. Now i'm trying to test WP map. I want to overlay a linestring layer on the base layer. but it cannot render on canvas. what is the problem of the code below.

public MainPage()
            //this.map.Map.Layers.Add(new TileLayer(new OsmTileSource()));
            this.map.Map.Layers.Add(new TileLayer(new GoogleTileSource(GoogleMapType.GoogleMap)));

            LineString line = new LineString();
            line.Vertices.Add(new SharpMap.Geometries.Point(-20037508.342789, -20037508.342789));
            line.Vertices.Add(new SharpMap.Geometries.Point(20037508.342789, 20037508.342789));

            Layer lay = new Layer("LineString");
            SharpMap.Data.Features features = new SharpMap.Data.Features();
            SharpMap.Data.IFeature feature = features.New();
            feature.Geometry = line;
            lay.DataSource = new SharpMap.Data.Providers.MemoryProvider(features);
            SharpMap.Styles.Color color = new SharpMap.Styles.Color();
            color.R = 129;
            color.G = 2;
            color.B = 134;
            lay.Style.Line.Color = color;
            lay.Style.Line.Width = 5;
            //SharpMap.Styles.Brush brush = new SharpMap.Styles.Brush();
            //brush.Fill = color;
            //lay.Style.Fill = brush;

            App.Current.Host.Content.Resized += Content_Resized;

And, the MapControl in Mapsui.Windows does not realize map click event right ? In WinForm of SharpMapUI, the MapControl has Query, Pan, Zoom function etc.

Jan 9, 2011 at 8:53 AM

hi cdqrain,

thanks for you complete example. It made it easy to find the problem. The Alpha value of the color had 0 as default value so was invisible. I just committed a fix that initializes it to 255.

With Map Click you mean Query, or just any map manipulation? Pan and Zoom (with mouse wheel) should work in WinForms and WPF. I have not looked at Query after the port from SharpMap. 

About the WP project. I did just the minimal thing to get it to compile, there could be all kinds of problems with it. So if you would like to use it for a project you should be confident you can fix such problems yourself. 


Jan 9, 2011 at 1:45 PM

thanks paul.

yes, map click to get lonlat to do query or to make a marker. In your MapControl the mousedown event is just to pan the map.

I should test most of the function before use it for a project. such as, overlay vector layer, marker layer, click the marker to popup infowindow. 

if possible, draw geometry on the map.

but i am not familar with SL and WP, so, i should stand on your shoulder. :-)