[Georuby-devel] Srid auto detection, manual models configuration.
ValiSystem
vali.system at free.fr
Mon Mar 19 14:50:42 EDT 2007
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 = '<the_catalog>' and
f_table_schema = '<the_schema>' and
f_table_name = '<the_table_name>' and
f_geometry_column = '<the_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 = '<the_table_name>' and
f_geometry_column = '<the_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
More information about the Georuby-devel
mailing list