OSGEarth環境搭建
1.下載OsgEaarth2.8源碼
https://codeload.github.com/gwaldron/osgearth/legacy.zip/osgearth-2.8
2.下載perl
編譯CURL需要perl
http://downloads.activestate.com/ActivePerl/releases/5.24.1.2402/ActivePerl-5.24.1.2402-MSWin32-x64-401627.exe
3.下載CURL源碼
https://codeload.github.com/bingxueyouwu/curl/zip/master

4.下載ZLIB源碼
http://124.205.69.163/files/523900000520E796/www.zlib.net/zlib-1.2.11.tar.gz

5.下載GDAL源碼
http://124.205.69.132/files/9063000005336BEB/download.osgeo.org/gdal/2.1.3/gdal213.zip
編譯GDAL,打開“VS2015 開發人員命令提示",

進入GDAL-2.1.3的目錄,
編譯32位版本命令
nmake /f makefile.vc
nmake /f makefile.vc install
nmake /f makefile.vc devinstall
編譯64位版本命令
nmake /f makefile.vc MSVC_VER=1900 WIN64=YES
nmake /f makefile.vc install MSVC_VER=1900 WIN64=YES
nmake /f makefile.vc devinstall MSVC_VER=1900 WIN64=YES
其中 MSVC_VER 和VS版本關系如下
# nmake -f makefile.vc MSVC_VER=xxxx
# where xxxx is one of following:
# 1900 = 14.0(2015)
# 1800 = 12.0(2013)
# 1700 = 11.0(2012)
# 1600 = 10.0(2010)
# 1500 = 9.0 (2008)
# 1400 = 8.0 (2005)
# 1310 = 7.1 (2003)
# 1300 = 7.0 (2002)
# 1200 = 6.0
可參考 http://www.rzrgm.cn/geospatial/p/5634033.html

編譯geos
>VCVARS32.BAT >cd d:\geos350 >atuogen.bat >nmake /f makefile.vc
geos編譯出現錯誤時參考 http://blog.sina.com.cn/s/blog_48ff6e140102x7gg.html
http://blog.csdn.net/csxiaoshui/article/details/51800955
osgearth 暫不支持geos 3.6.1 詳見,請使用3.5.1及以前版本
5.下載protobuf
https://github.com/google/protobuf
編譯protobuf
https://github.com/google/protobuf/blob/master/cmake/README.md
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
Compiling nmake
Install nmake install
編譯OSGEarth中出現的問題:
1.OSGEarth/QuadTree.h中 找不到META_Shape這個預定義方法,進而產生一系列的錯誤
解決過程:首先,這QuadTree.h這個文件中看到有<osg/Shape>和<osg/Geometry>兩個引用,推斷META_Shape這個預定義方法有可能定義在OSG中。
接著在OPENSCENEGRAPH工程搜索META_Shape,果然在<osg/KdTree>中發現了這個預定義方法,心想是不是OSGEarth工程的引用目錄中
沒有添加OSG_INCLUE_PATH,添加之后,依然報錯。再次檢查了QuadTree.h的引用頭文件和命名空間,發現引用命名空間中沒有osg,懷疑是
未引命名空間導致項目找不到KdTree這個頭文件,依此思中,在QuadTree.h和QuadTree.cpp中添加 【 using namespace osg; 】后,錯
誤消失。
2.提示找不到這個 osg::Referenced::setThreadSafeReferenceCounting 成員方法
解決過程:這個問題相對簡單一些,這個方法已經被移除掉了,可參見giuhub上的回答。
浙公網安備 33010602011771號