zoukankan      html  css  js  c++  java
  • [原]CentOS7部署PostGis

    转载请注明原作者(think8848)和出处(http://think8848.cnblogs.com)

    本文参考了《An almost idiot's guide to install PostgreSQL 9.5, PostGIS 2.2 and pgRouting 2.1.0 with Yum 》和PostGis官方网站的安装说明

    1. 先安装Postgresql

    请参见《CentOS7下安装并简单设置PostgreSQL笔记

    2. 先安装几个以后能用的上的工具包,免得用的时候又没有

    sudo yum  install wget net-tools epel-release -y

    3. 安装PostGis

    sudo yum install postgis2_95 postgis2_95-client -y

    postgis2_95-client中包含了PostGis的命名行工具,如:shp2pgsql,pgsql2shp,raster2pgsql等,看名字也大概知道是什么意思了。

    4. 安装ogrfdw

    ogrfdw的全称是OGR Foreign Data Wrapper

    sudo yum install ogr_fdw95 -y

    更多ogr_fdw信息,请参见这里

    5. 安装pgRouting

    sudo yum install pgrouting_95 -y

    6. 建立一个Postgresql数据库,然后安装PostGis扩展

    #先切换到postgres用户,然后连接到postgres数据库
    su postgres
    
    psql
    
    #创建一个新的数据库,指定数据库所有者为think8848
    CREATE DATABASE chinaosmgisdb OWNER think8848
    
    #查看数据库列表
    l
    
    #切换到chinaosmgisdb数据库
    c chinaosmgisdb

    安装PostGis扩展

    CREATE EXTENSION postgis;
    CREATE EXTENSION postgis_topology;
    CREATE EXTENSION ogr_fdw;

    PostGis的扩展列表

    -- Enable PostGIS (includes raster)
    CREATE EXTENSION postgis;
    -- Enable Topology
    CREATE EXTENSION postgis_topology;
    -- Enable PostGIS Advanced 3D 
    -- and other geoprocessing algorithms
    -- sfcgal not available with all distributions
    CREATE EXTENSION postgis_sfcgal;
    -- fuzzy matching needed for Tiger
    CREATE EXTENSION fuzzystrmatch;
    -- rule based standardizer
    CREATE EXTENSION address_standardizer;
    -- example rule data set
    CREATE EXTENSION address_standardizer_data_us;
    -- Enable US Tiger Geocoder
    CREATE EXTENSION postgis_tiger_geocoder;

    7. 验证安装结果

    SELECT postgis_full_version();

    如果能成功显示版本信息,说明PostGis成功安装好了。

  • 相关阅读:
    shell脚本之数组
    shell脚本之函数
    shell脚本之sed
    shell脚本的for循环与read
    shell脚本之if语句
    shell脚本正则表达式
    shell的编程原理
    《梦断代码》阅读笔记03
    12.19学习总结
    《梦断代码》阅读笔记02
  • 原文地址:https://www.cnblogs.com/think8848/p/6010695.html
Copyright © 2011-2022 走看看