Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The following SQL is working fine from the terminal:

  ST_Transform(ST_GeomFromText('POINT(-3.163916 55.926528)',4326),32630),
)) FROM geo_table


when I try it through a python psycopg2 try-except it fails and postGIS returns a WARNING: OGC WKB expected, EWKB provided - use GeometryFromEWKB() for this. I am slightly confused here, any help would be much appreciated!

I have more queries in my code that they use a stored geometry without the need of a wrapper like ST_GeomFromWKB. I don't understand why this happens.

Cheers, A

share|improve this question
I don't see this error with PostGIS 2.0. What version? Also, are you trying to find the nearest polygon to a point of interest? If so, then this is not the way to it. – Mike T Feb 8 '13 at 1:14
i think geometry data type is not w/wkb. i mean there is st_asWKB and st_asEWKB functions for it. To get that query work you should replace geometry with st_asEWKB(geomgetry). AND that last should be something like ST_Transform(ST_Boundary(geometry),32630) – simplexio Feb 8 '13 at 8:39
Thank you for your help, it still does not really work though. What I am trying to do is get the distance from a given point to the nearest boundary. This point will always fall within a polygon - that is why I include st_boundary. – Antony Feb 8 '13 at 10:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.