[postgis-users] Cast geometry as geography

Andreas Forø Tollefsen andreasft at gmail.com
Mon Jun 20 00:48:48 PDT 2011


Hi.
I want to measure the length of lines within polygons in km and not in dd.

Why can't I cast this as geography to get length in km? I get this error:

ERROR:  gbox_overlaps: geometries have mismatched dimensionality

********** Error **********

ERROR: gbox_overlaps: geometries have mismatched dimensionality
SQL state: XX000


I also tried to ST_Transform into Eckert VI, but it has been running
for 50 hours++ without a result.
Here is my query with cast as geography:

DROP TABLE IF EXISTS v0map_rd_length;
SELECT priogrid_land.gid, priogrid_land.cell,
SUM(ST_Length(ST_Intersection(v0map_rd.geom::geography,
priogrid_land.cell::geography)))/1000 as length_km
INTO v0map_rd_length
FROM priogrid_land, v0map_rd
WHERE ST_Intersects(v0map_rd.geom::geography, priogrid_land.cell::geography)
GROUP BY priogrid_land.gid, priogrid_land.cell
;



More information about the postgis-users mailing list