trying to just write the geometry
added error handling and optional WKB or WKT