zoukankan      html  css  js  c++  java
  • [GDAL]GEOS和Proj4编译

    1.下载源码

    geos-3.4.2.tar.bz2  http://trac.osgeo.org/geos/

    proj-4.8.0.zip     http://trac.osgeo.org/proj/wiki/WikiStart#Download

    启动VS2010 x64兼容命令提示符

    2.首先编译GEOS,进入Geos目录后

    1 autogen.bat
    2 nmake /f makefile.vc 

    编译debug版本

    nmake /f makefile.vc BUILD_DEBUG=YES

    说明F:gdalgeos-3.4.2文件夹下的makefile.vc

    # This makefile.vc delegates making targets to srcmakefile.vc
    # so it's just a thin wrapper.

     1 #
     2 # NMAKE Makefile to build GEOS on Windows
     3 ###############################################################################
     4 # This makefile.vc delegates making targets to srcmakefile.vc
     5 # so it's just a thin wrapper.
     6 #
     7 #     Building on Win32 with Visual Studio
     8 #     ------------------------------------
     9 #
    10 # 1) Requires Visual C++ 2002 or later
    11 # 2) Build running command "nmake /f makefile.vc" in top-level directory
    12 #
    13 # Produces:
    14 #  srcgeos.dll: DLL - only exports the C API
    15 #  srcgeos_i.lib: Stub library to link against for use of geos.dll. 
    16 #  srcgeos.lib: static library for use of C or C++ API.
    17 ###############################################################################
    18 GEOS_ROOT=.
    19 !INCLUDE $(GEOS_ROOT)
    make.opt
    20 
    21 default: src_dir
    22 
    23 src_dir:
    24     cd src
    25     $(MAKE) /f makefile.vc
    26     cd ..
    27 
    28 clean:    
    29     cd src
    30     $(MAKE) /f makefile.vc clean
    31     cd ..
    View Code

    3.接着编译Proj4

    nmake /f makefile.vc install-all

    4.最后编译GDAL

    首先说明下我的文件目录F:gdal文件夹下将gdal-1.10.0、geos-3.4.2和proj-4.8.0放在一起

    使用记事本或者其他的文本编辑器打开GDAL源代码目录下的nmake.opt文件,找到“# Uncomment for GEOS support”这句,大概在490行左右,将下面三行代码:

    #GEOS_DIR=C:/warmerda/geos

    #GEOS_CFLAGS =-I$(GEOS_DIR)/capi -I$(GEOS_DIR)/source/headers -DHAVE_GEOS

    #GEOS_LIB     =$(GEOS_DIR)/source/geos_c_i.lib

    修改为:

    GEOS_DIR=F:gdalgeos-3.4.2
    GEOS_CFLAGS = -I$(GEOS_DIR)/capi -I$(GEOS_DIR)/include -DHAVE_GEOS
    GEOS_LIB     = $(GEOS_DIR)/src/geos_c_i.lib

    GEOS_DIR是geos-3.4.2编译后的文件夹路径:F:gdalgeos-3.4.2。头文件主要在capi和include文件夹。

    找到下面三行代码:

    #PROJ_FLAGS =-DPROJ_STATIC

    #PROJ_INCLUDE =-Id:projectsproj.4src

    #PROJ_LIBRARY =d:projectsproj.4srcproj_i.lib

    修改为:

    #PROJ_FLAGS = -DPROJ_STATIC
    PROJ_INCLUDE = -IF:gdalproj-4.8.0src
    PROJ_LIBRARY = F:gdalproj-4.8.0srcproj_i.lib

    不知道是不是我之前用中文路径的原因,开始编译时出了找不到geos_c.h的错误,然后我就改成现在的路径。

    接下来的修改和编译按照http://www.cnblogs.com/yhlx125/p/3550957.html执行就可以了。

  • 相关阅读:
    Linux| 系统管理命令
    Linux | 文件编辑命令
    Linux | 权限管理命令
    Linux | 文件管理命令
    Linux | 帮助命令
    前端性能优化之防抖、节流
    css盒子模型
    linux常用命令(持续更新)
    Vue ERROR TypeError: Cannot read property 'upgrade' of undefined
    hbuilder-x使用js-beautiful格式化代码
  • 原文地址:https://www.cnblogs.com/yhlx125/p/3632157.html
Copyright © 2011-2022 走看看