It's been a few days that I'm struggling with WKB strings. I need to be able to parse it in order to get the equivalent geometry and extract points coordinates (X,Y,Z). I can't use PostGIS functions. The only java library that I found was the JTS Topology Suite, that i use as follow :
String wkb = "01ea030000020000009b4d3899fe95154153d97e8f43875941000000000000454003085bc23f9615411b4dc406578759410000000000004740"
byte[] aux = WKBReader.hexToBytes(wkb);
try {
Geometry geom = new WKBReader().read(aux);
} catch (ParseException e) {
e.printStackTrace();
System.err.println("Bad WKB string.");
}
But the it gives me the following error :
com.vividsolutions.jts.io.ParseException: Unknown WKB type 234
234 is the decimal value of the hexadecimal string 'ea'. It's like the JTS Library was only looking at the frist 2 bytes instead of looking at the 4 bytes 'ea03', that correspond to 1002 in little endian (so a LineStringZ).
My question is then : does the JTS Topology Suite handle LineStringZ ? If not, why points can have a Z value ? And how can I parse it correctly ?
Thanks you for reading !