Have data in CSV file Parsing the CSV file to insert the data into Postgres DB. One of the column data type is 'geography'
Data is in this form "0101000020BB100000FCA776FD9E256240F2EBF2AD0F0D43C0"
g = "0101000020BB100000FCA776FD9E256240F2EBF2AD0F0D43C0"
Inserting this data with ST_GeomFromText(@g)
.. But throws this error
Npgsql.PostgresException : XX000: parse error - invalid geometry Data: Severity: ERROR InvariantSeverity: ERROR SqlState: XX000
MessageText: parse error - invalid geometry Hint: "01" <-- parse error at position 2 within geometry File: lwgeom_pg.c Line: 58
Routine: pg_parser_errhint
Code
insert into testtable values (@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8,@s9,@s10,@s11,@s12,@s13,@s14,@s15,@s16,@s17,@s18,@s19,@s20,@s21,@s22,@s23,@s24,@s25,@s26,@s27,ST_GeomFromWKB(@s28))
Thanks All, Solved the issue, by casting to geometry then while inserting used the wrapper function "ST_GeomFromWKB"