[postgis-users] new table for every layer a good design idea?

Racine, Sylvain syracine at sympatico.ca
Sat Jan 5 09:30:30 PST 2013


Hi Rashad,

I give you answer about ORM only. I don't program in C++, but in web 
application langage (PHP). I know that there is an ORM in Java who 
enable spatial field. It's Hibernate Spatial 
(http://www.hibernatespatial.org). I never user it but I supposed it 
take in charge mostly spatial database (Oracle Spatial, PostGIS). But 
you don't program in Java... nor me.

I was looking for a spatial ORM in PHP and I heard about Doctrine who 
has "user-defined" type field. Many programmer seem to use this 
solution. I think you should looking in that way for an ORM in C++. It's 
a short term solution.

The other way is to write you own ORM or start to improve one who 
already exists in C++... I think it's a long term solution who should be 
developped in other langages than Java.

It's my conclusion after a couple of years of spatial programmation in PHP.

Best regard

Sylvain Racine
iGreffe Geomatique
Granby, Quebec, Canada

Le 2013-01-05 00:59, Rashad M a écrit :
>
> Is it a good design idea to maintain separate tables for each layer in 
> a PostGIS database?. Every layer is defined by users. A user creates 
> his/her layer say ATM location. I dont have control over the table 
> definition of the layers much This makes it impossible to predict 
> fields(attribute fields and type are not known initially) used in the 
> table/layers. School vs roads have different geometry and set of 
> attributes.
>
> The problem is traditional databases wont advice for having dynamic 
> tables very much. Does the same apply to spatial databases?
>
> How to use ORM Database library with postgis table. I am using C++ and 
> libpq. but would like to change to an ORM model.
>
> If i am using single table for every layer postgis may not work 
> because of geometry type. or i can have 3 table point, line, polygon 
> and data goes into the correct table based on geometry type.
>
> Each table contains
> layerId,featureId,geomety, data(hstore)
> data = field1=>value1, field2=>value2 etcc
>
> i need to use hstore for fields "data" because name/type of attributes 
> are not known before runntime.
>
> Also layerId will be redundant in the table.
> Fo example: a layer with 1Lakh features will have a column layerId 1L 
> times  which will not be there if I use separate tables 
> for separate layers.
>
>
> But does adding a new table for every layer may become a bottleneck? 
> BTW, I am writing a web app
>
>
>
> -- 
> Regards,
>    Rashad
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130105/a5d462b2/attachment.html>


More information about the postgis-users mailing list