Hi Jerome,

On Thu, Oct 8, 2009 at 8:19 PM, Jérôme Caba
<[email protected]> wrote:
> Jérôme Caba a écrit :
>> Hi,
>>
>> I try to use GeoAlchemy with an existant postgis db and I have one error
>> when I want to query tables.
>> My model :
>> class Communes(Base):
>>     __tablename__ = "COMMUNES"
>>     id_commune = Column(Integer,primary_key=True)
>>     article_majuscule_commune = Column(Unicode)
>>     nom_majuscule_commune = Column(Unicode)
>>     article_minuscule_commune = Column(Unicode)
>>     nom_minuscule_commune = Column(Unicode)
>>     the_geom_rt500 = GeometryColumn(Polygon(2))
>>     the_geom_dgi = GeometryColumn(Polygon(2))
>>     the_geom_bdc = GeometryColumn(Polygon(2))
>>
>> I can query all fields like this :
>> my_comm = session.query(Communes).filter_by(id_commune='46626').first()
>> print our_comm .nom_minuscule_commune
>> and it works
>>
>> But when I want to retry the geometry (in wkt or other formats):
>> print session.scalar(Communes.the_geom_bdc.wkt)
>> I only obtain an error : "AttributeError : 'NoneType' object has no
>> attribute 'scalar'

That should be
>> print session.scalar(my_comm.the_geom_bdc.wkt)

I request you to direct questions related to geoalchemy to the new group
http://groups.google.com/group/geoalchemy

Sanjiv

>>
>> My version of sqlalchemy is 0.5.6, Geoalchemy 0.1 and python 2.5
>> Have I misunderstood something ? It seems like the geom format is not
>> recognized...
>>
>> Thank you very much
>>
>>
>>
> I progress a little, sorry for my mistake : I wrote
>
> print session.scalar(Communes.the_geom_bdc.wkt)
>
> and obtain an error like this : AttributeError : Neither
> 'InstrumentedAttribute' object nor 'Comparator' object has an attribute
> 'wkt'
>
> What did I do wrong ? thanks
>
> --
> Jérôme Caba
> BMSQ
> Département Information Géographique
> BP 12668
> 31326 CASTANET TOLOSAN Cedex
> téléphone : 05.61.28.93.43
> fax     : 05.61.28.92.82
> mail : [email protected]
>
> _______________________________________________
> Community mailing list
> [email protected]
> http://lists.gispython.org/mailman/listinfo/community
>
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to