資源簡介
1.gdal c# 開發環境配置
2.Gdal.AllRegister() 產生的"OSGeo.GDAL.GdalPINVOKE"異常解決方法及相關代碼和數據。
代碼片段和文件信息
/******************************************************************************
?*
?*?Name:?????GdalConfiguration.cs.pp
?*?Project:??GDAL?CSharp?Interface
?*?Purpose:??A?static?configuration?utility?class?to?enable?GDAL/OGR.
?*?Author:???Felix?Obermaier
?*
?******************************************************************************
?*?Copyright?(c)?2012?Felix?Obermaier
?*
?*?Permission?is?hereby?granted?free?of?charge?to?any?person?obtaining?a
?*?copy?of?this?software?and?associated?documentation?files?(the?“Software“)
?*?to?deal?in?the?Software?without?restriction?including?without?limitation
?*?the?rights?to?use?copy?modify?merge?publish?distribute?sublicense
?*?and/or?sell?copies?of?the?Software?and?to?permit?persons?to?whom?the
?*?Software?is?furnished?to?do?so?subject?to?the?following?conditions:
?*
?*?The?above?copyright?notice?and?this?permission?notice?shall?be?included
?*?in?all?copies?or?substantial?portions?of?the?Software.
?*
?*?THE?SOFTWARE?IS?PROVIDED?“AS?IS“?WITHOUT?WARRANTY?OF?ANY?KIND?EXPRESS
?*?OR?IMPLIED?INCLUDING?BUT?NOT?LIMITED?TO?THE?WARRANTIES?OF?MERCHANTABILITY
?*?FITNESS?FOR?A?PARTICULAR?PURPOSE?AND?NONINFRINGEMENT.?IN?NO?EVENT?SHALL
?*?THE?AUTHORS?OR?COPYRIGHT?HOLDERS?BE?LIABLE?FOR?ANY?CLAIM?DAMAGES?OR?OTHER
?*?LIABILITY?WHETHER?IN?AN?ACTION?OF?CONTRACT?TORT?OR?OTHERWISE?ARISING
?*?FROM?OUT?OF?OR?IN?CONNECTION?WITH?THE?SOFTWARE?OR?THE?USE?OR?OTHER
?*?DEALINGS?IN?THE?SOFTWARE.
?*****************************************************************************/
using?System;
using?System.IO;
using?System.Reflection;
using?Gdal?=?OSGeo.GDAL.Gdal;
using?Ogr?=?OSGeo.OGR.Ogr;
namespace?SharpMap
{
????public?static?partial?class?GdalConfiguration
????{
????????private?static?bool?_configuredOgr;
????????private?static?bool?_configuredGdal;
????????///?
????????///?Function?to?determine?which?platform?we‘re?on
????????///?
????????private?static?string?GetPlatform()
????????{
????????????return?IntPtr.Size?==?4???“x86“?:?“x64“;
????????}
????????///?
????????///?Construction?of?Gdal/Ogr
????????///?
????????static?GdalConfiguration()
????????{
????????????var?executingAssemblyFile?=?new?Uri(Assembly.GetExecutingAssembly().GetName().Codebase).LocalPath;
????????????var?executingDirectory?=?Path.GetDirectoryName(executingAssemblyFile);
????????????if?(string.IsNullOrEmpty(executingDirectory))
????????????????throw?new?InvalidOperationException(“cannot?get?executing?directory“);
????????????var?gdalPath?=?Path.Combine(executingDirectory?“gdal“);
????????????var?nativePath?=?Path.Combine(gdalPath?GetPlatform());
????????????//?Prepend?native?path?to?environment?path?to?ensure?the
????????????//?right?libs?are?being?used.
????????????var?path?=?Environment.GetEnvironmentVariable(“PATH“);
????????????path?=?nativePath?+?“;“?+?Path.Combine(nativePath?“plugins“)?+?“;“?+?path;
????????????Environme
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????505168??2014-03-29?15:50??GDAL_CSharp環境配置.docx
?????文件???16341514??2014-03-29?14:03??gdal_data_config.rar
?????文件???????5488??2014-03-29?13:55??GdalConfiguration.cs
-----------?---------??----------?-----??----
?????????????16852170????????????????????3
評論
共有 條評論