最近在用sharpmap写一个小工具,在加载遥感影像的时候遇到了一个问题,具体问题如下,求大神指教啊!!!
这是我的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpMap.Forms;
using SharpMap.Layers;
using GeoAPI.Geometries;
using SharpMap.Rendering.Symbolizer;
using SharpMap.Layers.Symbolizer;
using SharpMap.Styles;
using SharpMap.Data.Providers;
using System.Data.OleDb;
using System.IO;
using SharpMap.Data;
using System.Collections.ObjectModel;
using NetTopologySuite.Geometries;
using System.Drawing.Text;
using System.Drawing.Drawing2D;
using SharpMap.Rendering;
namespace AddLayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string file1 = Environment.CurrentDirectory + @"\Data\房产信息修改.shp";
string file2 = Environment.CurrentDirectory + @"\Data\矩形区域(1)\Level18\矩形区域(1).tif";
string rasterfilename1 = Environment.CurrentDirectory + @"\Data\矩形区域(1)\Level18\矩形区域(1).tif";
public void load()
{
RasterPointSymbolizer pointSymbol = new RasterPointSymbolizer();
pointSymbol.Scale = 0.8f;
PuntalVectorLayer puntalVectorLayer = new PuntalVectorLayer(file1, new ShapeFile(file1, true), pointSymbol);
LabelLayer labelLayer = new LabelLayer(file1);
labelLayer.DataSource = puntalVectorLayer.DataSource;
labelLayer.Enabled = true;
GdalRasterLayer rasterLayer1 = new GdalRasterLayer("矩形区域(1)", rasterfilename1);
//GdiImageLayer la = new GdiImageLayer("tif", file2);
//la.MaxVisible = 1;
//la.MinVisible = 1;
//mapBox1.Map.Layers.Add(la);
mapBox1.Map.Layers.Add(puntalVectorLayer);
//VectorLayer mylayer = new VectorLayer("11");
//mylayer.DataSource = new ShapeFile(file1);
//mapBox1.Map.Layers.Add(mylayer);
mapBox1.Map.ZoomToExtents();
}
private void Form1_Load(object sender, EventArgs e)
{
mapBox1.ActiveTool = MapBox.Tools.Pan;
load();
mapBox1.Map.ZoomToExtents();
mapBox1.Refresh();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
mapBox1.Map.ZoomToExtents();
mapBox1.Refresh();
}
}
}