简体   繁体   中英

M-Values in PostGIS

I wonder how to create PolylineM-Geometries in Postgis.

CREATE TABLE tabm (oid integer primary key);

SELECT AddGeometryColumn ('public','tabm','geom',25832,'MULTILINESTRING',3);

insert into tabm(oid,geom) values(
   1,
   ST_GeomFromText('MULTILINESTRINGM ((572929 5831262 300, 572929 5831562 400))')
);

Above code results in

ERROR: FEHLER:  Column has Z dimension but geometry does not
SQL state: 22023

(PosgreSQL 13.3)

The geom column isn't of type MULTILINESTRINGM . Change the column and you'll be able to perform inserts:

SELECT AddGeometryColumn ('public','tabm','geom',25832,'MULTILINESTRINGM',3);

Demo: db<>fiddle

CREATE TABLE tabm (oid integer primary key);
SELECT AddGeometryColumn ('public','tabm','geom',25832,'MULTILINESTRINGM',3);
INSERT INTO tabm(oid,geom) VALUES 
(1,'SRID=25832;MULTILINESTRINGM ((572929 5831262 300, 572929 5831562 400))'::geometry); 

SELECT ST_AsText(i.geom),ST_M(i.geom) FROM tabm,
LATERAL ST_DumpPoints(geom) i(j);

st_astext                      st_m
-----------------------------------
POINT M (572929 5831262 300)    300
POINT M (572929 5831562 400)    400
    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM