WKBReadingError: Could not create geometry because of errors while reading input

1.9k Views Asked by At

I want to upload data with postgis using an sql query. See below the code

df = gpd.GeoDataFrame.from_postgis('select ST_ASTEXT(point_sm) as geom from df.df' , con=engine, geom_col='geom')

I get this error:

ParseException: Invalid HEX char

WKBReadingError: Could not create geometry because of errors while reading input.

I haven't tried much to be honest. I am new to this and couldn't figure out where to start.

1

There are 1 best solutions below

0
JGH On BEST ANSWER

You are requesting a text but the function expects a geometry expressed in WKB.

Try changing the query to

select point_sm as geom from df.df