Source code checked in, #73611
Edited Unassigned: Can't find MapControl in Visual Studio 2012 [24217]
Every thing is OK. But when I choose DotSpatial.Control to add toolbox items, I found there's no MapControl!

Can you tell me how to resolve? Thanks!
Closed Issue: Removing raster layers does not lead to consequent release of memory resources [23970]
When loading a raster file the memory usage (executable size in memory) increases by almost 3 times the size of the input file.
Removing the newly loaded raster layer does not lead to a consequent memory release.
If I call myself GC.collect() some of the memory is released but not all of the memory increment due to the raster loading.
Loading again the same raster after removing it leads to a further increment of memory usage higher than after the first loading.
So the consequence is that this bug leads to a quick memory saturation if one is working with a number of raster layers.
I debugged my application when calling the "map1.addlayer()" but could not find where the bug is (the library code is too nested for my programming skills).
I think this is a strong bug for those working with raster data.
Comments: I did testing with this patch and memory releasing working perfectly. I'm closing this issue.
Commented Issue: File is not closed after Raster.Save() [23885]
Sample code:
```
AppManager app = new AppManager();
app.LoadExtensions();
IRaster raster = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
raster.Save();
File.Open("test.tif", FileMode.Open, FileAccess.Read, FileShare.None);
```
Even if I try calling Close and Dispose the error persists.
Creating a raster with same name results in error too:
```
AppManager app = new AppManager();
app.LoadExtensions();
IRaster raster = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
raster.Save();
raster.Close();
raster.Dispose();
IRaster raster2 = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
```
Comments: ** Comment from web user: mogikanin **
Not reproduced with latest DS.
This code working fine.
```
IRaster raster = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
raster.Save();
raster.Close();
var file = File.Open("test.tif", FileMode.Open, FileAccess.Read, FileShare.None);
// .... do something with file
```
Edited Issue: File is not closed after Raster.Save() [23885]
Sample code:
```
AppManager app = new AppManager();
app.LoadExtensions();
IRaster raster = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
raster.Save();
File.Open("test.tif", FileMode.Open, FileAccess.Read, FileShare.None);
```
Even if I try calling Close and Dispose the error persists.
Creating a raster with same name results in error too:
```
AppManager app = new AppManager();
app.LoadExtensions();
IRaster raster = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
raster.Save();
raster.Close();
raster.Dispose();
IRaster raster2 = Raster.CreateRaster("test.tif", null, 20, 20, 1, Type.GetType("System.Single"), new string[1] { "" });
```
Source code checked in, #73612
Commented Issue: Saved Int32 value in DBF is read as Int64 [24177]
Comments: ** Comment from web user: mogikanin **
Hi, can you show code sample to reproduce this issue?
Commented Issue: Poor performance using AddShape [23740]
I don't understand the code well enough to know if this is be design (to perhaps reset some indices) but it results in unacceptable performance.
Comments: ** Comment from web user: mogikanin **
Hi, can you show sample code how to reproduce this issue?
Created Unassigned: 一个问题 [25052]
foreach (DotSpatial.Data.IFeature f in __fs.Features__)
{
//
}
从外部导入一个shp文件(我的测试文件大小为5MB),每当调用fs.Features时,内存直线上升。
New Post: Export to jpg
here my code to save the map view to bitmap images.
Dim ExportImgDialogFilterText As String = "Bitmap (*.BMP)|*.BMP|Enhanced Metafile (*.EMF)|*.EMF|Exchangeable (*.EXIF)|*.EXIF|Graphics Interchange (*.GIF)|*.GIF|Icon (*.ICO)|*.ICO|Icon (*. ICON)|*.ICON|Joint Photographic (*.JPEG)|*.JPEG|Joint Photographic (*.JPG)|*.JPG|Portable Network (*.PNG)|*.PNG|Tag Image (*.TIFF)|*.TIFF|Tag Image (*.TIF)|*.TIF|Metafile (*.WMF)|*.WMF"
Dim dlg = New SaveFileDialog() With {.Filter = ExportImgDialogFilterText, .SupportMultiDottedExtensions = True & .DefaultExt = "bmp"}
Dim MapBitmap As New Bitmap(Map1.MapFrame.ImageRectangle.Width, Map1.MapFrame.ImageRectangle.Height)
Dim MapImage As Image
With dlg
.FilterIndex = 1
.OverwritePrompt = True
.Title = "Export Map"
.FileName = "Map_Export"
If dlg.ShowDialog(Me) = DialogResult.OK Then
Map1.DrawToBitmap(MapBitmap, Map1.ClientRectangle)
MapImage = MapBitmap
Select Case System.IO.Path.GetExtension(dlg.FileName).ToUpper
Case ".BMP"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
Case ".EMF"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Emf)
Case ".EXIF"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Exif)
Case ".GIF"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Gif)
Case ".ICO", ".ICON"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Icon)
Case ".JPEG", ".JPG"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
Case ".PNG"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Png)
Case ".WMF"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Wmf)
Case ".TIFF", ".TIF"
MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Tiff)
Case Else
MsgBox("Can not save file with that extension", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "File Type Can Not Be Saved")
End Select
End If
End With
Commented Unassigned: 一个问题 [25052]
foreach (DotSpatial.Data.IFeature f in __fs.Features__)
{
//
}
从外部导入一个shp文件(我的测试文件大小为5MB),每当调用fs.Features时,内存直线上升。
Comments: ** Comment from web user: mogikanin **
Hi, so you have a hard memory using when you just looping through fs.Features? Can you attach sample file?
New Post: DotSpatial "TrackingLayer"?
To draw polygons, you should do something like this:
_dsDrawUtil.Symbolizer = DSDrawingUtil.CreatePolygonSymbolizer(....);
_dsDrawUtil.DrawPolygon(...);
You should be able to pass null for the shClip argument to DrawPolygon if you do not need to clip. I vaguely recall that I had to add clipping when I had data that extended WAY outside the normal window extent. I think it was something to do with GDI+ not liking window coordinates greater than a 16-bit number or something along those lines.
HTH
Commented Issue: ProjectionInfo.Over not used in Reproject.ConvertToLatLon [23809]
if (!source.Over)
{
xy[i * 2] = Adjlon(xy[i * 2]);
}
This is similar to how ConvertToProjected does it.
Comments: ** Comment from web user: geostats **
Here is a sample. When the change is made in my original post the error goes away.
```
static void Main(string[] args)
{
ProjectionInfo geographic = KnownCoordinateSystems.Geographic.World.WGS1984;
ProjectionInfo projected = KnownCoordinateSystems.Projected.World.WebMercator;
geographic.Over = true;
projected.Over = true;
double[] pointsXY = { -445, 33 };
double[] pointsXYCopy = { -445, 33 };
double[] pointsZ = { 0 };
Console.WriteLine("Geographic = " + pointsXY[0] + ", " + pointsXY[1]);
Reproject.ReprojectPoints(pointsXY, pointsZ, geographic, projected, 0, 1);
Console.WriteLine("Projected = " + pointsXY[0] + ", " + pointsXY[1]);
Reproject.ReprojectPoints(pointsXY, pointsZ, projected, geographic, 0, 1);
Console.WriteLine("Geographic = " + pointsXY[0] + ", " + pointsXY[1]);
if (Math.Abs(pointsXY[0] - pointsXYCopy[0]) > 0.00000000001 || Math.Abs(pointsXY[1] - pointsXYCopy[1]) > 0.00000000001)
{
Console.WriteLine("Projection error.");
}
Console.WriteLine("Press any key to continue");
Console.ReadKey();
}
```
Source code checked in, #73616
Commented Issue: ProjectionInfo.Over not used in Reproject.ConvertToLatLon [23809]
if (!source.Over)
{
xy[i * 2] = Adjlon(xy[i * 2]);
}
This is similar to how ConvertToProjected does it.
Comments: Associated with changeset 73616: Fixed #23809: ProjectionInfo.Over not used in Reproject.ConvertToLatLon
Commented Issue: ProjectionInfo.Over not used in Reproject.ConvertToLatLon [23809]
if (!source.Over)
{
xy[i * 2] = Adjlon(xy[i * 2]);
}
This is similar to how ConvertToProjected does it.
Comments: ** Comment from web user: mogikanin **
Hi, geostats. Thank you for the sample. I applied suggested fix to the source code.
Edited Issue: ProjectionInfo.Over not used in Reproject.ConvertToLatLon [23809]
if (!source.Over)
{
xy[i * 2] = Adjlon(xy[i * 2]);
}
This is similar to how ConvertToProjected does it.
Source code checked in, #73617
Closed Unassigned: Some modifies in Rastermagic [24840]
When using rastermagic, the result raster is moving to right and botom 1/2cellsize.
I add some code in the end of the class to re move the raster into it's right location:
........
'======================Adding code
Dim envelope1 As Extent = UnionEnvelope(input1, input2)
envelope1.MinX = envelope1.MinX - smallestCellRaster.CellWidth / 2
envelope1.MinY = envelope1.MinY + smallestCellRaster.CellHeight / 2
envelope1.MaxX = envelope1.MaxX - smallestCellRaster.CellWidth / 2
envelope1.MaxY = envelope1.MaxY + smallestCellRaster.CellHeight / 2
Dim bound1 As New RasterBounds(noOfRow, noOfCol, envelope1)
output.Bounds = bound1
'======================End of adding code
output.Save()
End Function
Comments: Resolved with changeset 73617: DotSpatial.Tools: fixed wrong bounds issue in RasterMultiply/Add/Substract. #24840
Commented Issue: ShapeFiles with PointZ are assumed to have four values, when it can be only three [23224]
This makes DotSpatial crash since it's trying to read too much data from the ShapeFile.
Comments: ** Comment from web user: mogikanin **
Hi, can you attach sample file?