Problems with building Mapsui solution

Dec 20, 2012 at 12:00 PM

Hi,

I've downloaded the complete solution file, but facing problems building it.

Could any one please give exact steps to get the solution working?

plus please give the software pre-requistes?

Thanks in advance!

Poonam

 

 

Dec 21, 2012 at 9:23 PM

I use Visual Studio 2012 now. That should build the desktop and Silverlight (-SL) projects. But not the Windows 8 (-W8) projects if you are not on Windows 8. 

I expect those to build on VS2010 as well but did not test recently. You need this update to .net framework 4.0.3 for Visual Studio 2010:  http://www.microsoft.com/en-us/download/details.aspx?id=29054

What VS version are you using? Biuilding for desktop, SL or W8?

Dec 22, 2012 at 5:06 AM

I am using VS2010 and building for SL.

Thank you! your inputs help me build the solution, needed to install the SP1 for VS2010 and official release of SL5.

I have a few queries:

1. I need to retrieve the Lat and Long co-ordinates on click of the mouse on the map.

2. I need to place a custom icon on the map again on click of the mouse.

Please suggest the classes in should look into.

Thanks in advance!

Poonam

Dec 22, 2012 at 11:53 AM

for 1: 

First you need to transform from screen coordinates to world. With viewport.ScreenToWorld

Then you need to transform from your map projection to wgs84. These days most maps are in SphericalMercator (this is true in the case you use a tilelayer like Bing, or OSM). In that case you can use this class that happens to be in included:

http://mapsui.codeplex.com/SourceControl/changeset/view/dc564902e2d7#Mapsui.Rendering.XamlRendering/SphericalMercator.cs

 

for 2:

Look at this thread for point symbols.

http://mapsui.codeplex.com/discussions/406547

Dec 28, 2012 at 6:58 AM

Hi Paul,

Thanks for your previous reponses.

I'm now able to click on the maps and retrieve their world co-ordinates. Although, i now need to draw a line and the following piece of code doesn't seem to work.

private static MemoryProvider aMP = new MemoryProvider();
List<Point> aPointsList = new List<Point>();
aPointsList.Add(new Point(x,y));
aPointsList.Add(new Point(x - 10, y - 20));

Mapsui.Geometries.LineString aLine = new LineString(aPointsList);
            
var aLineFeature = new Feature { Geometry = aLine};
aMP.Features.Add(aLineFeature);
layer.DataSource = aMP; 

Am i missing something?

 

 


Dec 30, 2012 at 9:09 AM

You need to set a Style on the layer. I need to find a better design for this.

Dec 30, 2012 at 5:35 PM

I tried inserting the following piece of code to the one above...

static ICollection<IStyle> Styles = new Collection<IStyle>(); 

VectorStyle aStyle = new VectorStyle
            {
                Line = new Pen(Color.Black, 2),
                Outline = new Pen(Color.Red, 1),
                Fill = new Brush { Color = Color.Red },
            };

            Styles.Add(aStyle);

            layer.Styles = Styles;

This didn't work, any more suggestions??

 

Jan 4, 2013 at 3:57 AM

Hi Paul,

I am still awaiting your reply on the post above.

Regards,

Poonam