使用ogr2ogr 转换格式的问题

LoginOut 2009-12-08 10:00:20


cm运行:
D:\Program Files\FWTools2.4.6\bin>ogr2ogr -f "PostgreSQL" PG:"host=localhost use
r=postgres dbname=template_postgis password=123" d:\states.shp
报错:
ERROR 1: INSERT command for new feature failed.
ERROR: new row for relation "states" violates check constraint "enforce_geotype
_wkb_geometry"

Command: INSERT INTO "states" ("wkb_geometry" , "state_name", "state_fips", "sub
_region", "state_abbr", "land_km", "water_km", "persons", "families", "houshold"
, "male", "female", "workers", "drvalone", "carpool", "pubtrans", "employed", "u
nemploy", "service", "manual", "p_male", "p_female", "samp_pop") VALUES (GeomFro
。。。。。。。。。。。
1.000000000, 2318671.000000000, 2462797.000000000, 1783061.000000000, 17
32837.000000000, 376449.000000000, 202169.000000000, 2481342.000000000,
111536.000000000, 586994.000000000, 260308.000000000, 0.4850000
00, 0.515000000, 684773.000000000)
ERROR 1: Terminating translation prematurely after failed
translation of layer states (use -skipfailures to skip errors)

可以看到在template_postgis中已经创建了表states,但是只有表结构
因为PostgresQL支持事务回滚,所以没有了数据,既然支持事务回滚
那表结构也不应该创建啊?

还想问个,如何把dwg格式地图存入postgis里面?

shp导入到postgis已经能用PostgreSQL完成,但是用 org2ogr不知道如何使用?


ogr2ogr使用的是FWTools246.exe安装后的bin里面的
...全文
773 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
传说中的堕落 2009-12-08
  • 打赏
  • 举报
回复
ogr库我用过,但是是用C++调用的

而且我没用PostGIS,帮你顶一下

2,143

社区成员

发帖
与我相关
我的任务
社区描述
它是一种特定的十分重要的空间信息系统。它是在计算机硬、软件系统支持下,对整个或部分地球表层(包括大气层)空间中的有关地理分布数据进行采集、储存、管理、运算、分析、显示和描述的技术系统。
社区管理员
  • 地理信息系统
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧