I am trying to add a point with GeoAlchemy 2. However I am getting getting error on insert action saying

---sqlalchemy.exc.InternalError: (psycopg2.InternalError) parse error - invalid geometry HINT: "POINT(39.9130572,3" <-- parse error at position 18 within geometry [SQL: 'INSERT INTO spots (name, geom) VALUES (%(name)s, ST_GeomFromEWKT(%(geom)s)) RETURNING spots.id'] [parameters: {'name': 'testspot', 'geom': 'POINT(39.9130572,32.7892743)'}]---

I check the spots table and its geometry appears as point.Could anyone tell me where is the problem ?

class Spot(Base): tablename = 'spots' id = Column(Integer, primary_key=True) name = Column(String) geom = Column(Geometry('POINT'))


if not session.query(Spot).filter_by(name='testspot').first(): spot = Spot(name='testspot', geom='POINT(39.9130572,32.7892743)') print(spot.geom) session.add(spot) session.commit() else: spot=session.query(Spot).filter_by(name='testspot').first()

1 Answer 1


The problem was the comma between coordinates in 'geom':'POINT(39.9130572 32.7892743)'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.