sharpmap添加遥感影像问题

葡萄葡萄 2017-04-08 02:12:11
最近在用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();
}
}
}
...全文
88 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧