smathermather / postgis-etc

A small repo of et cetera PostGIS code
GNU Lesser General Public License v2.1
11 stars 16 forks source link

mixed dimension geometries error #1

Open aborruso opened 10 years ago

aborruso commented 10 years ago

Hi, I would like to test pyramidMaker function, and I started with a small test:

SELECT pyramidMaker(ST_Point(-71.1043443253471, 42.3150676015829), 2, 2, 1) AS the_geom;

But I have this error:

lwcollection_construct: mixed dimension geometries: 0/2

What's wrong in my query?

Thank you

smathermather commented 10 years ago

You need to make your ST_Point a 3D point, e.g. SELECT pyramidMaker(ST_Point(-71.1043443253471, 42.3150676015829, 500), 2, 2, 1) AS the_geom;

aborruso commented 10 years ago

Then I think I must made the same for postgis cookbook chp07.uas_locations layer.

Thank you very much, tomorrow I will try

aborruso commented 10 years ago

Hi @smathermather for me it works with

SELECT pyramidMaker(ST_MakePoint(-71.1043443253471, 42.3150676015829,500), 2, 2, 1) AS the_geom;

Moreover I have the same problem with "Reconstructing Unmanned Aerial Vehicle (UAV) image footprints with PostGIS 3D" recipe of your book.

I have transformed the original "uas_locations_altitude_hpr_3734.shp" layer in a 3D layer with:

ogr2ogr -zfield altitude_a new.shp uas_locations_altitude_hpr_3734.shp

Then I have imported it in postgis:

shp2pgsql -s 3734 -W LATIN1 new new | psql -U postgres -d postgis_cookbook

Then I have executed

CREATE TABLE public.viewshed AS SELECT 1 AS gid, roll, pitch, heading, fileName,
public.pbr(the_geom, radians(0)::numeric,
radians(heading)::numeric, radians(roll)::numeric,
radians(40)::numeric, radians(50)::numeric, ( (3.2808399 *
altitude_a) - 838)::numeric) AS the_geom FROM public.new;

And I have had this error:

ERROR: lwcollection_construct: mixed dimension geometries: 3/2 CONTEXT: funzione SQL "pyramidmaker" istruzione 1 funzione SQL "pbr" istruzione 1 \ Error **

ERRORE: lwcollection_construct: mixed dimension geometries: 3/2 SQL state: XX000 Context: funzione SQL "pyramidmaker" istruzione 1 funzione SQL "pbr" istruzione 1

What do you think about?

aborruso commented 10 years ago

If I set "ST_Force_3D" seems to work

CREATE TABLE public.viewshed AS SELECT 1 AS gid, roll, pitch, heading, fileName,
public.pbr(ST_Force_3D(the_geom), radians(0)::numeric,
radians(heading)::numeric, radians(roll)::numeric,
radians(40)::numeric, radians(50)::numeric, ( (3.2808399 *
altitude_a) - 838)::numeric) AS the_geom FROM public.new;

aborruso commented 10 years ago

Using "ST_Force_3D" I have an output, but it seems unusable. Ogrinfo gives me unknown geometry type:

Layer name: viewshed Geometry: Unknown (any) Feature Count: 167 Extent: (1745429.572753, 499266.413882) - (1747104.125808, 500939.917819) Layer SRS WKT: (unknown) Geometry Column = the_geom gid: Integer (0.0) roll: Integer (2.0) pitch: Integer (3.0) heading: Integer (4.0) filename: String (254.0)

Thank you

smathermather commented 10 years ago

Ah, yes. Here we are at the edges of technology. (ogr likely does not support this yet) You'll need horao to view anything you create here. You can also view a 2D only version in the nightly builds of QGIS. This is good for sanity checks.

kikislater commented 6 years ago

Doing this in 2018 and qgis is now able to display polyhedralsurface z

capture du 2018-06-14 13-08-50

Thank you Stephen. But why lidar DEM is in feet, it's not common !