Hello,


I'm trying to use PostGIS with GeoAlchemy, being totally new to both. According to available documentation and what I need (A point representing longitude and latitude of row), I have

   class PointOfInterest(Base):
        __tablename__ = ...

        ...

        geom = geoalchemy.GeometryColumn(Point(2))



To read from geom column, I apparently need:

   poi = PointOfInterest()

   lon = session.scalar(poi.geom.x)
   lat = session.scalar(poi.geom.y)


And to set the value I need

   poi.geom = geoalchemy.WKTSpatialElement("POINT({lon}
   {lat})".format(lon, lat))


Of course, the above is possibly vulnerable for sql injections so I must make sure lon and lat are really numbers.


But is there a simpler/safer/saner way to do both? Can I update the geom column somehow to set only one value of the pair?


Also, I'm not quite sure how to query rows with X, Y being with N units of a reference point X0, Y0?


Thanks.


--


.oO V Oo.


Work Hard,
Increase Production,
Prevent Accidents,
and
Be Happy!  ;)

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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