From vali.system at free.fr Mon Mar 19 14:50:42 2007 From: vali.system at free.fr (ValiSystem) Date: Mon, 19 Mar 2007 19:50:42 +0100 Subject: [Georuby-devel] Srid auto detection, manual models configuration. Message-ID: Hello, I've beeing testing GeoRuby all this afternoon, and i've some question/suggestions : 1. Is there a way to define manually the geometry colomun using the table model ? i think about something like that : class Numvoiri < ActiveRecord::Base set_table_name "numvoiri" set_primary_key "numvoiri_id" set_srid 4326 set_geometry_columns ["geom"] belongs_to :text, :class_name => "NumvoiriText", :foreign_key => "text_id" end to define column and override auto detection. I didn't manage to find something like that in docs, but i guess it's just missing. Or if needs to be coded, it could be nice to do it :) 2. As it's wrote in the docs, Postgis refuses to use operators between geometries with different srids. But this could be autodetected easily : select srid from geometry_columns where f_table_catalog = '' and f_table_schema = '' and f_table_name = '' and f_geometry_column = ''; Since tuples from geometry_columns are primary keys one attributes used in this where clause, you can safely assume that it will return a single element. Also, i would not, by default, define f_table_catalog and f_table_schema, and reduce query to always known attributes : select srid from geometry_columns where f_table_name = '' and f_geometry_column = ''; and provide a mechanism to user to make them able to define the schema and catalog, and leave them the responsability to check that (but that needs to warn if several tuples are returned). I may patch post_gis_adapter.rb myself if you're interested, but i don't have a deep knowledge of rails internals. Thanks for the good work. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/georuby-devel/attachments/20070319/b19db8db/attachment.html From vali.system at free.fr Tue Mar 20 07:12:24 2007 From: vali.system at free.fr (ValiSystem) Date: Tue, 20 Mar 2007 12:12:24 +0100 Subject: [Georuby-devel] Srid auto detection, manual models configuration. In-Reply-To: References: Message-ID: <56C6C071-4000-4E8C-AEC3-C181D3184E89@free.fr> On 19 mars 07, at 19:50, ValiSystem wrote: > > Hello, > > I've beeing testing GeoRuby all this afternoon, and i've some > question/suggestions : > > 1. Is there a way to define manually the geometry colomun using the > table model ? > i think about something like that : > > class Numvoiri < ActiveRecord::Base > set_table_name "numvoiri" > set_primary_key "numvoiri_id" > set_srid 4326 > set_geometry_columns ["geom"] > belongs_to :text, > :class_name => "NumvoiriText", > :foreign_key => "text_id" > end > > to define column and override auto detection. I didn't manage to > find something like that in docs, but i guess it's just missing. Or > if needs to be coded, it could be nice to do it :) > > 2. As it's wrote in the docs, Postgis refuses to use operators > between geometries with different srids. But this could be > autodetected easily : > > select srid from geometry_columns where > f_table_catalog = '' and > f_table_schema = '' and > f_table_name = '' and > f_geometry_column = ''; > > Since tuples from geometry_columns are primary keys one attributes > used in this where clause, you can safely assume that it will > return a single element. Also, i would not, by default, define > f_table_catalog and f_table_schema, and reduce query to always > known attributes : > > select srid from geometry_columns where > f_table_name = '' and > f_geometry_column = ''; > > and provide a mechanism to user to make them able to define the > schema and catalog, and leave them the responsability to check that > (but that needs to warn if several tuples are returned). > > I may patch post_gis_adapter.rb myself if you're interested, but i > don't have a deep knowledge of rails internals. > > Thanks for the good work. > > > _______________________________________________ > Georuby-devel mailing list > Georuby-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/georuby-devel okay i read more things about georuby internals, and it seems that my 2. remarks are totally pointless :) but i'm still interested for suggestions to setup a manuel model definition. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/georuby-devel/attachments/20070320/ccba46d4/attachment.html From vali.system at free.fr Tue Mar 20 07:13:07 2007 From: vali.system at free.fr (ValiSystem) Date: Tue, 20 Mar 2007 12:13:07 +0100 Subject: [Georuby-devel] Srid auto detection, manual models configuration. In-Reply-To: References: Message-ID: <129E8D69-5C57-4EBD-BD8D-DCF7EF8CB19B@free.fr> On 19 mars 07, at 19:50, ValiSystem wrote: > > Hello, > > I've beeing testing GeoRuby all this afternoon, and i've some > question/suggestions : > > 1. Is there a way to define manually the geometry colomun using the > table model ? > i think about something like that : > > class Numvoiri < ActiveRecord::Base > set_table_name "numvoiri" > set_primary_key "numvoiri_id" > set_srid 4326 > set_geometry_columns ["geom"] > belongs_to :text, > :class_name => "NumvoiriText", > :foreign_key => "text_id" > end > > to define column and override auto detection. I didn't manage to > find something like that in docs, but i guess it's just missing. Or > if needs to be coded, it could be nice to do it :) > > 2. As it's wrote in the docs, Postgis refuses to use operators > between geometries with different srids. But this could be > autodetected easily : > > select srid from geometry_columns where > f_table_catalog = '' and > f_table_schema = '' and > f_table_name = '' and > f_geometry_column = ''; > > Since tuples from geometry_columns are primary keys one attributes > used in this where clause, you can safely assume that it will > return a single element. Also, i would not, by default, define > f_table_catalog and f_table_schema, and reduce query to always > known attributes : > > select srid from geometry_columns where > f_table_name = '' and > f_geometry_column = ''; > > and provide a mechanism to user to make them able to define the > schema and catalog, and leave them the responsability to check that > (but that needs to warn if several tuples are returned). > > I may patch post_gis_adapter.rb myself if you're interested, but i > don't have a deep knowledge of rails internals. > > Thanks for the good work. > > > _______________________________________________ > Georuby-devel mailing list > Georuby-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/georuby-devel okay i read more things about georuby internals, and it seems that my 2. remarks are totally pointless :) but i'm still interested for suggestions to setup a manuel model definition. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/georuby-devel/attachments/20070320/5c81cde2/attachment-0001.html