将MIF和MID文件转换为postgis表

时间:2017-02-22 11:06:04

标签: postgis ogr2ogr

我有这样的表:

CREATE TABLE postcode_area_boundaries
(
    ogc_fid INTEGER,
    wkb_geometry GEOMETRY(MultiPolygon,3857),
    postarea VARCHAR(2),
    area_km DOUBLE PRECISION,
    area_mi DOUBLE PRECISION,
);

CREATE TABLE postcode_area_points
(
    ogc_fid INTEGER PRIMARY KEY NOT NULL,
    wkb_geometry GEOMETRY(Point,3857),
    postcodearea VARCHAR(254),
    postcodeareaname VARCHAR(254)
);

我还有文件:

邮政编码区域Boundaries.MID

"AB","Aberdeen"
POLYGON((383707 866131,383465 866240,383302 866387,383202 866505,383089 866586,.....))
"AL","St Albans"
POLYGON((526248 203348,....))
.......

邮政编码区域Boundaries.MIF

VERSION 300
DELIMITER ","
COORDSYS EARTH PROJECTION 8,79,"m",-2,49,0.99960127,400000,-100000
COLUMNS 2
  POSTCODEAREA CHAR (0)
  POSTCODEAREANAME CHAR (0)
DATA
POINT 384222.000 819125.000
POINT 518661.000 209809.000
POINT 407763.000 285514.000
POINT 371106.000 147748.000
.... as many points as many was areas in MID file (about 126)

我可能应该使用 ogr2ogr ,但不知道如何使用。我正在尝试这样的命令:

ogr2ogr -f PostgreSQL PG:"<dbconn>" "Postcode Area Boundaries.MIF" -t_srs EPSG:3857 -nlt MULTIPOLYGON -overwrite -nln postcode_area_boundaries

但我有这样的错误:

  

警告1:要插入的几何图形是Point类型,而图层类型   几何类型是多边形。插入可能会失败错误1:   新功能的INSERT命令失败。错误:几何类型(点)   与列类型(MultiPolygon)不匹配

任何人都可以帮我吗?

0 个答案:

没有答案