首页 > 解决方案 > 制作一个包含使用现代 spatialite 编译的 ogr 的 docker 图像

问题描述

我正在尝试运行一个 ogr2ogr 命令,该命令需要使用足够新的 SpatiaLite 构建的 GDAL 版本以具有 ST_MakeValid 功能---来自讨论组,这似乎是 4.0+

但是,ubuntugis中的 gdal 版本看起来像是现代版本的 gdal

$ gdalinfo --version
GDAL 2.2.4, released 2018/03/19

我有一个现代空间派:

$ sudo apt-get install libspatialite-dev spatialite-bin libspatialite7
... already installed

$ spatialite
SpatiaLite version ..: 4.3.0a   Supported Extensions:

但是该ogr2ogr命令似乎没有使用存储库中作为独立二进制文件的 spatialite 版本进行编译,而是使用较旧的版本进行编译。(我不知道如何检查它是用哪个版本编译的,只是这个命令在它是最新的时成功,但失败了

这是我的 Dockerfile:

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install -y software-properties-common \
 && add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y && apt-get update \
 && apt-get install --yes gdal-bin curl \
 && curl -LKS 'https://github.com/OpenDataDE/State-zip-code-GeoJSON/raw/master/ks_kansas_zip_codes_geo.min.json' -o  ks_kansas_zip_codes_geo.min.json \ 
 && ogrinfo --version \ 
 && ogr2ogr -f GeoJSON -dialect sqlite -sql "select ST_MakeValid(geometry),STATEFP10,ZCTA5CE10,GEOID10,CLASSFP10,MTFCC10,FUNCSTAT10,ALAND10,AWATER10,INTPTLAT10,INTPTLON10,PARTFLG10 from \"ks_kansas_zip_codes_geo.min\"" clean.json ks_kansas_zip_codes_geo.min.json

我可以在 repos 中更改什么,或者如何手动编译gdal以获得包含该 ST_MakeValid函数的 spatialite 版本?

笔记

收集可能相关的搜索结果:

对 dockerfile 的更新

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \ 
 && apt-get install -y software-properties-common \
 && add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y \
#    # INSTALLING GRASS DOES NOT SEEM HELPFUL
#       && add-apt-repository ppa:grass/grass-devel -y \
 && apt-get update \
 && apt-get install --yes curl git autoconf libtool \
#   # TRIED RTTOPO FROM HERE:
#   #   http://postgis.17.x6.nabble.com/Why-can-t-PostGIS-configure-find-libgeos-c-td3552982.html
#   # AND HERE:
#   #   https://gitlab.com/rttopo/rttopo
#   # DOES NOT SEEM FRUITFUL
#       apt-get install --yes libgeos-dev \ 
#       && git clone https://gitlab.com/rttopo/rttopo.git \
#       && cd rttopo && ./autogen.sh  && ./configure --enable-rttopo=yes --with-geosconfig=/usr/bin/geos-config  && make && make install   \
#       && cd \
 && apt-get install --yes gdal-bin  \
 && curl -LKS 'https://github.com/OpenDataDE/State-zip-code-GeoJSON/raw/master/ks_kansas_zip_codes_geo.min.json' -o  ks_kansas_zip_codes_geo.min.json \ 
 && ogrinfo --version \
 && ogr2ogr -f GeoJSON -dialect sqlite -sql "select ST_MakeValid(geometry),STATEFP10,ZCTA5CE10,GEOID10,CLASSFP10,MTFCC10,FUNCSTAT10,ALAND10,AWATER10,INTPTLAT10,INTPTLON10,PARTFLG10 from \"ks_kansas_zip_codes_geo.min\"" clean.json ks_kansas_zip_codes_geo.min.json

标签: dockergdalspatialite

解决方案


推荐阅读