Re: [GeoAlchemy] union using geoalchemy and postgis 2

92 views
Skip to first unread message

Eric Lemoine

unread,
Sep 3, 2012, 3:04:58 AM9/3/12
to geoal...@googlegroups.com
On Mon, Sep 3, 2012 at 3:44 AM, binadam <ibna...@gmail.com> wrote:
> Looks like my last post didn't make, retry...
>
> If I have:
>
> class MyGeom(Base):
> __tablename__ = 'my_geom'
>
> id = Column(Integer, autoincrement=True, primary_key=True)
> geom = Column(Point)
> extra = Column(String)
>
>
> and I do a union e.g.
>
> a = m.DBSession.query( m.MyGeom ).filter(m.MyGeom.extra==None)
> b = m.DBSession.query( m.MyGeom ).filter(m.MyGeom.extra!=None)
> a.union(b)
>
> I get this error:
>
> sqlalchemy.exc.ProgrammingError: (ProgrammingError) function
> st_asbinary(bytea) is not unique
> LINE 1: SELECT anon_1.my_geom_id AS anon_1_my_geom_id, ST_AsBinary(a...
> ^
> HINT: Could not choose a best candidate function. You might need to add
> explicit type casts.
>
>
> I see there is a ticket about this:
> http://trac.osgeo.org/postgis/ticket/1869
> So my question is there a workaround in geoalchemy using ORM?
> (happens with geoalchemy & geoalchemy2)



Hi

I can indeed reproduce the issue. I don't know how to fix it for now,
but I'll look into it.




--
Eric

Eric Lemoine

unread,
Sep 3, 2012, 11:21:30 AM9/3/12
to geoal...@googlegroups.com
Now fixed in SQLAlchemy:
<http://hg.sqlalchemy.org/sqlalchemy/rev/f1efb20c6d61> (Thank you
Mike). And I added a test in GeoAlchemy 2 for that:
<https://github.com/geoalchemy/geoalchemy2/commit/de3ed867e820f4f864f7f0a07491d37496909c14>.

Tell us if it works for you.

--
Eric
Reply all
Reply to author
Forward
0 new messages