Skip to content

Instantly share code, notes, and snippets.

@jamiecook
Last active September 7, 2017 13:49
Show Gist options
  • Save jamiecook/88de39f83909168c4dcc87f6311aa5e8 to your computer and use it in GitHub Desktop.
Save jamiecook/88de39f83909168c4dcc87f6311aa5e8 to your computer and use it in GitHub Desktop.
// 6 - Check WKB -> Geo -> WKB roundtrip
// See https://github.com/ewestern/geos/pull/22
template<>
template<>
void object::test<5>()
{
std::string initialWkb = "0105000020C46E000001000000010200000004000000EE2DE25E859A20410829F224364B5A41BD757FB6679A204115C6D8E9304B5A4177111862469A2041A03F04E32C4B5A41BC1D3ADD459A2041793C8CD92C4B5A41";
geos::geom::Geometry *geom = wkbreader.readHex(initialWkb);
std::stringstream result_stream;
wkbwriter.setOutputDimension( 2 );
wkbwriter.setByteOrder( 1 );
wkbwriter.setIncludeSRID( 0 );
wkbwriter.writeHEX( *geom, result_stream );
std::string roundTripWkb = result_stream.str();
ensure_equals( roundTripWkb, initialWkb );
geos::geom::Geometry *geom2 = wkbreader.readHEX(result_stream);
assert( geom->equals(geom2) );
delete geom;
delete geom2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment