docker - 制作一个包含使用现代 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 版本?
笔记
收集可能相关的搜索结果:
- https://gis.stackexchange.com/questions/157406/how-to-re-compile-ogrinfo-against-gdal-used-by-qgis?rq=1]
- http://trac.osgeo.org/gdal/wiki/BuildHints
- https://pastebin.com/iE4zwQTb
- https://github.com/GeographicaGS/Docker-GDAL2此 Docker 映像未针对正确的 libspatialite 编译
- https://hub.docker.com/r/roblabs/gdal/此 Docker 映像也未针对正确的 libspatialite 编译
对 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
解决方案
推荐阅读
- database - I have encountered #Name? error in access form
- mysql - go-xorm reverse mysql has error reverse.go:196 Error 1064: Unsupported command(COM_STMT_PREPARE)
- java - android studio java中布局管理器的空指针异常
- ios - Unwind segue to the root in a different storyboard in swift
- string - Shell script (bash) to match a string variable with multiple values
- postgresql - Docker Compose 无法从数据库 (jdbc:postgresql://db:5432/postgres) 为用户“postgres”获取连接:连接尝试失败
- reactjs - 用条件反应打字稿组件集道具
- java - 更改 Android Spinner 的 textColor 在三星设备中无法正常工作
- json - 如何在 vscode 片段中为乳胶创建正则表达式片段
- math - 偏微分比较静力学垄断问题