[postgis-devel] PostGIS and X3D - Adding a optionnal parameter for value -1

TECHER David davidtecher at yahoo.fr
Mon Apr 9 18:44:05 PDT 2007


Hi PostGISers,

Last week, I managed myself to try the idea from Olivier COURTIN and 
David  David DESBUISSON, i.e
the new function asx3d() for PostGIS

As everyboby knows the tools:
- Google Sketchup for building 3D model with the option to export the 
model to .kmz
-  kml2x3d done by Flux team (http://www.mediamachines.com/downloads.php 
that let you convert a kml file to
a x3d file

I've tried the tools above in order to importing a few x3d data to 
postgis and in order to testing the asx3d() function.

AFAI, writing a x3d parser /loader in C++ from x3d to postgis could be 
done using a  projet like http://tinyxml.sourceforge.net
My code is available at http://www.davidgis.fr/download/x3dtopgsql.cpp. 
I'm not a good C++ programer sorry and this code
is not really optimized.

In order to to that, i have to import someting like

INSERT INTO great_home(id,vertices,the_geom) values 
(0,array[[0,1,2,3,4,-1,5,6,7,8,9,-1,......,-1,24,25,14,15,23,-1,25,24,20,19,-]],GeomFromEWKT('SRID=-1;MULTIPOINT()'));

instead of

IINSERT INTO great_home(id,vertices,the_geom) values 
(0,array[[0,1,2,3,4,],[5,6,7,8,9,],......],[24,25,14,15,23,],[25,24,20,19]],GeomFromEWKT('SRID=-1;MULTIPOINT(........)'));

I did that by modifying the lwgeom/lwgeom_x3d.c done by olivier and david
--------------------------------------------------------------------------------------------------------------------------------------------------------------
        /* -1 value are ignored (could be a way to code 
postgis-users at postgis.refractions.net>
           various faces dimension in Postgres array) */
        //if (value != -1)
        //{
            j++;
            sprintf(buf,"%i,",value);
            add_str_simple(buf_face, buf);
        //}
-------------------------------------------------------------------------------------------------------------------------------------------------------------
The loader I've written work great with x3d file created by kml2x3d.

So I ask myself if it could be available to have the parameter -1 as a 
optionnal parameter in asx3d() function
i.e something like

asx3d(geometry, integer[],parameter_for_value_-1???)

I ask for that because parsing the coordIndex from a x3d file is not 
possible. PostgreSQL reports to me the following error

multidimensional arrays must have array expressions with matching dimensions

for example something like array[[1,2,3][1,3,4][4,7,12,13]]
That's the only solution I've found!


Let's me know. Thanks.


	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com



More information about the postgis-devel mailing list