I'm not sure if this is a PostGIS issue, a JTS issue, or an issue at all --
but, below, JTS produces a WKB that is not parseable (via ST_GeomFromWKB)
by Postgis -- it is the JTS wkb-representation of an empty polygon.
===============================
(1) Get WKB from PostGIS
gis=> select ST_GEOMFromText('POLYGON EMPTY');
st_geomfromtext
--------------------
010300000000000000
(1 row)
(2) Write to JTS, and read back.
WKBWriter writer = new WKBWriter();
WKBReader reader = new WKBReader();
// 010300000000000000
byte[] fromPostgis = {1, 3, 0, 0, 0, 0, 0, 0}; // little-endian, polygon, 0
rings
// 00000000030000000100000000
byte[] throughJTS = writer.write(reader.read(fromPostgis)); // big endian,
polygon, 1 ring, 0 points
(3) Try to write back to PostGIS
gis=> select ST_GeomFromWKB(E'\\x00000000030000000100000000');
ERROR: Polygon must have at least four points in each ring
================================
JTS-Version = 1.13
POSTGIS="2.1.0 r11822"
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user