Tag Archives: PostGIS

导入landuse数据的最终脚本

经过漫长的测试(3天的运行),修改后的最终版本可以实现: 保存当前进度 下次运行可以从上次进度运行 可以更新县区代码 可以更新时间 最终的代码如下: #!/bin/sh # cd /opt/to_reback/data/landuse #set -x d1=./tmpdata1 d2=./tmpdata2 YEAR=”80年代末 1995年 2000年” for a in $YEAR; do for b in $a/*; do #province, 目录判断 if [ -d $b ]; then rm -fdr $d1 rm -fdr … Continue reading

Posted in Linux, PostGIS | Tagged , | Leave a comment

用shell脚本导入landuse数据到postgis

全国的土地利用数据,80年代末,1995和2000年3期数据,ARCINFO COVERAGE格式,打算直接转入POSTGIS库中。 写了一个shell文件,花费了2天时间。主要是shell的东西是边看边写的,特别是变量处理,还真是麻烦。 运行shell文件要先进入到landuse目录,postgis里应该已经有westdc库,并且已经 进行了POSTGIS初始化,导入过landuse表,并且已经增加了areacode和year字段,不能为NULL,且默认为空值。 从avcbin格式到postgis库,因为数据表的关系,作了两次转换。提出了ARCINFO中的cov#和cov-id字段。 #!/bin/sh # cd /opt/to_reback/data/landuse tmpdata=./tmpdata YEAR=”80年代末 1995年 2000年” for a in $YEAR; do for b in $a/*; do #province, 目录判断 if [ -d $b ]; then rm -fdr $tmpdata for c in $b/ld*; do … Continue reading

Posted in Linux, PostGIS | Tagged , , | 4 Comments

install and use postgis in debian/ubuntu

因为postgis已经进入debian的库了,就把原来用source安钻的postgresql和postgis都删除掉,然后从库中安装。 aptitude install postgresql-8.1-postgis 然后再创建数据库,并作相应的初始化工作: createlang plpgsql yourdatabase psql -f `locate lwpostgis.sql` -d yourdatabase psql -f `locate spatial_ref_sys.sql` -d yourdatabase 最后再添加一个超级用户: create user xxx with password ‘passwd’ createuser createdb

Posted in PostGIS | Tagged , , | 1 Comment

传统的postgis安装方法@dapper

首先下载postgis source code,然后解开: 运行传统的安装方法: ./configure make 注意若提示缺少相关的lib,如pam,krb5等库,可从库中安装。 然后: checkinstall -D sudo dpkg -i 若不想用deb安装,也可以直接: make install

Posted in Linux, PostGIS | Tagged , , | 1 Comment

转移POSTGIS数据

从postgresql 8.01+ postgis 1.0 的数据拷贝到postgresql 7.4.7+ postgis 1.0上, 使用POSTGIS提供的pl程序不成功,后来试验最初的版本,虽然提示有些错误,但还是成功转移了数据。 pg_dump -f dumpfile.sql yourdatabase dropdb yourdatabase createdb yourdatabase createlang plpgsql yourdatabase psql -f lwpostgis.sql -d yourdatabase psql -f dumpfile.sql -d yourdatabase vacuumdb -z yourdatabase

Posted in PostGIS | Tagged | 5 Comments

pgadmin3 ubuntu 5.04 can not connect

默认安装的postgresql是认证所有用户的,全部都是ident sameuser,但是在pgadmin3怎么也无法进入。 最后只好修改postgresql的pg_hba文件了。 把来自localhost的全部改为trust。 (这样好像有点安全问题,但若本机只有自己能用,安全性也还过得去吧)

Posted in Linux, PostGIS | Tagged , , | Leave a comment

postgis在windows下的应用

目前,windows下的版本,postgresql官方已经开始支持,目前是8.0.1版本。POSTGIS目前官方尚不支持windows版本,但有支援者在进行同步维护windows版本,目前是1.0-rc6版本,估计很快就是1.0版本了。 1、安装 安装很简单,首先要安装postgresql,注意其有两个帐号,一是系统帐号,二是数据库管理帐号。安装程序可以新建用户,要提到一点,目前的postgresql数据库不支持远程安装,就是说,不能通过远程桌面进行安装(这个限制,不爽)。windows版本还包括了pgadmin3,图形化的管理界面。 然后安装postgis,需要前面安装postgresql的管理员帐号,同时其还要安装一个postgis数据库。 默认情况下,可执行文件都安装到postgresql的bin目录,几个SQL文件安装在postgresql的share/contrib目录下。 2、使用 对于中文用户来讲,首先要考虑数据库的编码问题,可以使用unicode,utf8,euc_cn等编码,默认的是unicode编码。 第一次使用unicode编码时移植linux下的应用,遇到了很多非常奇怪的问题。改用euc_cn编码,问题就少多了。 建库: createdb -U postgres -E EUC_CN db (linux环境下本机默认都不需要认证密码,但在windows系统下,默认是需要验证密码的) alter database db set client_encode=”EUC_CN” (这个要进入到psql环境中才能运行的,不确定是否必须,在linux环境下不需要) 搭建postgis环境: creatlang -U postgres plpgsql db (这个在windows下默认好象是不需要处理的) 引入postgis支持: psql -U postgres -d db -f lwpostgis.sql psql -U postgres … Continue reading

Posted in PostGIS | Tagged , , | 1 Comment

The xpsql Project

在POSTGRESQL基础上实现了XML的关系数据库管理 http://gborg.postgresql.org/project/xpsql/

Posted in PostGIS | Tagged , , | Leave a comment

postgis数据库初始化

createlang plpgsql yourdatabase psql -f lwpostgis.sql -d yourdatabase psql -f spatial_ref_sys.sql -d yourdatabase

Posted in PostGIS | Tagged , | 4 Comments

postgis中OID的问题

好象是postgis目前的一个BUG。 postgis-0.9,postgresql-8.0.0beta4,mapserver4.4beta2 目前的新版本的postgresql,建库时若不指定则默认无OID,但若无OID,则此空间表则不能被其他程序所访问。 包括MAPSERVER、QGIS等。

Posted in GIS | Tagged , , , | Leave a comment