Postgis - 从1.5迁移到2.3 - 解决方法 [英] Postgis - migration from 1.5 to 2.3 - workaround

查看:153
本文介绍了Postgis - 从1.5迁移到2.3 - 解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

研究员,

我已经很难尝试从postgis 1.5迁移到2.3。实际上,我曾多次尝试使用所有版本的postgis:2.0,2.1,2.2和2.3。

由于我已经花了几个星期的时间,并且因为我准备放弃,所以我继续使用旧版本的postgresql和postgis,希望我的问题找到回声某处...

我只想迁移一个表格字段,一个几何字段。因此,在尝试这样做之前,我想听听您是否有经验:



这个想法是从旧postgis(postgresql 9.2 ,postgis 1.5),并将表更新到新的postgis(postgresql 9.6,postgis 2.3)。



任何人都可以对此有任何说明吗? b

编辑---



我刚刚尝试导入我需要的表格,但出现错误:
违反约束enforce_srid_the_geom。

:($ / b>

非常感谢。


<如果您只需要迁移一个带有几何列的表,并且您在此处描述的过程中遇到麻烦,那么您可以使用解决方案

postgis.org/docs/postgis_installation.html#hard_upgraderel =nofollow noreferrer> http://www.postgis.org/docs/postgis_installation.html#hard_upgrade
我会建议一种解决方法:在旧数据库中创建一个文本字段,例如wkt_geom,然后执行

  update tablename set wkt_geom = st_astext(the_geom)

现在删除几何列,导出旧的数据库并导入到新的数据库中。然后,创建几何列和

$ $ p $更新表名set_geom = $ c>


Fellows,

I already had a really hard time trying to make a migration from a postgis 1.5 to 2.3. Actually I had many attempts to do that with all version of postgis: 2.0, 2.1, 2.2 and now 2.3.

As I have spent a few weeks with that, and as I am ready to drop that I keep using my old version of postgresql and postgis, I hope my question finds a echo somewhere...

I only want to migrate one table field, a geometry field. So before trying to do that, I would like to hear if any of you have experience with that:

The idea is to select the field from the old postgis (postgresql 9.2, postgis 1.5), and update the table to the new postgis (postgresql 9.6, postgis 2.3).

Anyone can say anything about it?

EDIT---

I have just tryed to import the table I needed, but I got an error: violation of constraint "enforce_srid_the_geom".

:(

Thanks a lot.

解决方案

If you need to migrate just a single table with a geometry column and you are getting troubles with the procedure described here http://www.postgis.org/docs/postgis_installation.html#hard_upgrade I'd suggest a workaround: create a text field in the old db, e.g. wkt_geom, then execute

update tablename set wkt_geom = st_astext(the_geom)

Now drop the geometry column, export the old db and import into the new one. Then, create the geometry column and

update tablename set the_geom = st_geomfromtext(wkt_geom, SRID_HERE)

这篇关于Postgis - 从1.5迁移到2.3 - 解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆