jdeolive/geodb — Issue #10: EWKB and WKB geometries are incompatible
Author: boonen
Created: 2011-10-26 12:46:00+00:00
State: open

We've come across a peculiar error in GeoDB's (E)WKB methods. Converting a geometry to an EWB (byte[]) and then converting this back to a geometry leads to a geometry that is not the same as its original.

The JUnit test below shows this behaviour (using version 0.6 of GeoDB from the Maven repository). A Point with coordinates (10, 10) is written to an EWKB and then transformed back to a Geometry. The result is a Poin with coordinates (0,0). Probably the error occurs on line 1173 of the GeoDB class).

```java
package geodb;

import junit.framework.Assert;
import geodb.GeoDB;

import org.hibernatespatial.test.EWKTReader;
import org.junit.Test;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;

public class GeoDBEWKBTest {

@Test
public void testGToEWKB() throws ParseException {
Geometry g = new EWKTReader().read("SRID=4326;POINT (10 10)");
// to and from ewkb
byte[] ewkb = GeoDB.gToEWKB(g);
Geometry gFromEwkb = GeoDB.gFromEWKB(ewkb);
Assert.assertEquals(g, gFromEwkb);
}
}
```