I would like to run a C# code to create a map based on OSM.
The code is from http://www.codeproject.com/Articles/87944/WPF-Map-Control-using-openstreetmap-org-Data
I can build and run the code at Visual Studio 2013.
I need to make the map focus on a given lat/lon. So I added
myMap.Focus(); // enable manual zoom-in/out
myMap.Center(37.806029, -122.407007, 16);
in MainWindow.xaml.cx.
I also added
<map:MapCanvas Latitude="37.806029" Longitude ="-122.407007" Zoom="16" x:Name="myMap"
/>
in MainWindow.xaml
But, when I ran the code, I got exception:
An exception of type 'System.ArgumentOutOfRangeException' occurred in PresentationCore.dll but was not handled in user code
Additional information: The parameter value must be greater than zero.
The exception occured at:
public ImageSource CreateImage()
{
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)this.**ActualWidth**, (int)this.**ActualHeight**, 96, 96, PixelFormats.Default);
bitmap.Render(_tilePanel);
bitmap.Freeze();
return bitmap;
}
The "ActualWidth" and "ActualHeight" are all 0s.
How can I set values for them ?
Any help would be appreciated.
asked
04 Oct '15, 23:29
usact
19●3●3●5
accept rate:
0%
debugging of your code and/or some other libraries/examples is not really the scope of this help site for OpenStreetMap, in my opinion