Hi,

Is it possible for sqlalchemy to utilise the methods of a SQL Server geography 
instance?

I have been adapting the postgis example from
http://svn.sqlalchemy.org/sqlalchemy/trunk/examples/postgis/postgis.py
which I believe formed the foundation for the GeoAlchemy project. I would like 
to get this example working for the SQL Server geography type. 

PostGIS, and the other spatial databases supported by GeoAlchemy, use database 
functions for their spatial operations, such as:

ST_AsText(geometry1)
ST_Intersects(  geometry1  , geometry2  )

So, using the example, the GISElement class can define:
    @property
    def wkt(self):
        return func.ST_AsText(literal(self, Geometry))

and the GISComparator class can do this:
    def intersects(self, other):
        return func.ST_Intersects(self.__clause_element__(), _to_postgis(other))

My problem arises because SQL Server has the spatial operators as methods of 
the geography type:
geography1.STAsText ( )
geography1.STIntersects ( geography2 )

Is it possible to use these geography methods within the GISComparator and 
GISElement classes?

Regards,
Daniel Pollock

Note: My current workaround is to create two database functions, 
my_STAsText(geography1) and my_STIntersects(geography1, geography2) and call 
these as per the postgis example.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to