In MSSQL Server, casting geometry to varbinary(max) produces a string that looks like this:
When you insert that string into a geometry column, a geometry object is built.
However, I can't seem to find out what the equivalent data format is in PostGIS / PostgreSQL in order to bring that same varbinary format out of a PostGIS geometry column (for the purpose of loading it into an MSSQL Server Geometry object).
I've read that the 'bytea' format does the same as varbinary, but the bytea version of a PostGIS geometry object looks like this:
Is there a way to get the same string that the MSSQL varbinary format produces from PostGIS / PostgreSQL?
Some background into this: I'm developing my own ETL tools using Python.
psycopg2 works well with PostgreSQL (PostGIS) database conversion - and PostgreSQL casts geometry to varchar in a SQL statement in my python script, which inserts nicely back into a PostGIS geometry column - PostGIS ETL done!
pypyodbc is working great for the receiving end of a psycopg2 query, but as the problem above states, I can't find the correct format to cast the PostGIS geometry to in the SQL in the python script... otherwise, I can read other columns from PostgreSQL and write them to MSSQL just fine.